@@ -38,7 +38,7 @@ setClass("DataFrame",
3838setMethod ("initialize ", "DataFrame", function(.Object, sdf, isCached) {
3939 .Object @ env <- new.env()
4040 .Object @ env $ isCached <- isCached
41-
41+
4242 .Object @ sdf <- sdf
4343 .Object
4444})
@@ -55,11 +55,11 @@ dataFrame <- function(sdf, isCached = FALSE) {
5555# ########################### DataFrame Methods ##############################################
5656
5757# ' Print Schema of a DataFrame
58- # '
58+ # '
5959# ' Prints out the schema in tree format
60- # '
60+ # '
6161# ' @param x A SparkSQL DataFrame
62- # '
62+ # '
6363# ' @rdname printSchema
6464# ' @export
6565# ' @examples
@@ -78,11 +78,11 @@ setMethod("printSchema",
7878 })
7979
8080# ' Get schema object
81- # '
81+ # '
8282# ' Returns the schema of this DataFrame as a structType object.
83- # '
83+ # '
8484# ' @param x A SparkSQL DataFrame
85- # '
85+ # '
8686# ' @rdname schema
8787# ' @export
8888# ' @examples
@@ -100,9 +100,9 @@ setMethod("schema",
100100 })
101101
102102# ' Explain
103- # '
103+ # '
104104# ' Print the logical and physical Catalyst plans to the console for debugging.
105- # '
105+ # '
106106# ' @param x A SparkSQL DataFrame
107107# ' @param extended Logical. If extended is False, explain() only prints the physical plan.
108108# ' @rdname explain
@@ -200,11 +200,11 @@ setMethod("show", "DataFrame",
200200 })
201201
202202# ' DataTypes
203- # '
203+ # '
204204# ' Return all column names and their data types as a list
205- # '
205+ # '
206206# ' @param x A SparkSQL DataFrame
207- # '
207+ # '
208208# ' @rdname dtypes
209209# ' @export
210210# ' @examples
@@ -224,11 +224,11 @@ setMethod("dtypes",
224224 })
225225
226226# ' Column names
227- # '
227+ # '
228228# ' Return all column names as a list
229- # '
229+ # '
230230# ' @param x A SparkSQL DataFrame
231- # '
231+ # '
232232# ' @rdname columns
233233# ' @export
234234# ' @examples
@@ -256,12 +256,12 @@ setMethod("names",
256256 })
257257
258258# ' Register Temporary Table
259- # '
259+ # '
260260# ' Registers a DataFrame as a Temporary Table in the SQLContext
261- # '
261+ # '
262262# ' @param x A SparkSQL DataFrame
263263# ' @param tableName A character vector containing the name of the table
264- # '
264+ # '
265265# ' @rdname registerTempTable
266266# ' @export
267267# ' @examples
@@ -306,11 +306,11 @@ setMethod("insertInto",
306306 })
307307
308308# ' Cache
309- # '
309+ # '
310310# ' Persist with the default storage level (MEMORY_ONLY).
311- # '
311+ # '
312312# ' @param x A SparkSQL DataFrame
313- # '
313+ # '
314314# ' @rdname cache-methods
315315# ' @export
316316# ' @examples
@@ -400,7 +400,7 @@ setMethod("repartition",
400400 signature(x = " DataFrame" , numPartitions = " numeric" ),
401401 function (x , numPartitions ) {
402402 sdf <- callJMethod(x @ sdf , " repartition" , numToInt(numPartitions ))
403- dataFrame(sdf )
403+ dataFrame(sdf )
404404 })
405405
406406# toJSON
@@ -489,7 +489,7 @@ setMethod("distinct",
489489# ' sqlContext <- sparkRSQL.init(sc)
490490# ' path <- "path/to/file.json"
491491# ' df <- jsonFile(sqlContext, path)
492- # ' collect(sample(df, FALSE, 0.5))
492+ # ' collect(sample(df, FALSE, 0.5))
493493# ' collect(sample(df, TRUE, 0.5))
494494# '}
495495setMethod ("sample ",
@@ -513,11 +513,11 @@ setMethod("sample_frac",
513513 })
514514
515515# ' Count
516- # '
516+ # '
517517# ' Returns the number of rows in a DataFrame
518- # '
518+ # '
519519# ' @param x A SparkSQL DataFrame
520- # '
520+ # '
521521# ' @rdname count
522522# ' @export
523523# ' @examples
@@ -568,13 +568,13 @@ setMethod("collect",
568568 })
569569
570570# ' Limit
571- # '
571+ # '
572572# ' Limit the resulting DataFrame to the number of rows specified.
573- # '
573+ # '
574574# ' @param x A SparkSQL DataFrame
575575# ' @param num The number of rows to return
576576# ' @return A new DataFrame containing the number of rows specified.
577- # '
577+ # '
578578# ' @rdname limit
579579# ' @export
580580# ' @examples
@@ -593,7 +593,7 @@ setMethod("limit",
593593 })
594594
595595# ' Take the first NUM rows of a DataFrame and return a the results as a data.frame
596- # '
596+ # '
597597# ' @rdname take
598598# ' @export
599599# ' @examples
@@ -613,8 +613,8 @@ setMethod("take",
613613
614614# ' Head
615615# '
616- # ' Return the first NUM rows of a DataFrame as a data.frame. If NUM is NULL,
617- # ' then head() returns the first 6 rows in keeping with the current data.frame
616+ # ' Return the first NUM rows of a DataFrame as a data.frame. If NUM is NULL,
617+ # ' then head() returns the first 6 rows in keeping with the current data.frame
618618# ' convention in R.
619619# '
620620# ' @param x A SparkSQL DataFrame
@@ -659,11 +659,11 @@ setMethod("first",
659659 })
660660
661661# toRDD()
662- #
662+ #
663663# Converts a Spark DataFrame to an RDD while preserving column names.
664- #
664+ #
665665# @param x A Spark DataFrame
666- #
666+ #
667667# @rdname DataFrame
668668# @export
669669# @examples
@@ -1167,7 +1167,7 @@ setMethod("where",
11671167# '
11681168# ' @param x A Spark DataFrame
11691169# ' @param y A Spark DataFrame
1170- # ' @param joinExpr (Optional) The expression used to perform the join. joinExpr must be a
1170+ # ' @param joinExpr (Optional) The expression used to perform the join. joinExpr must be a
11711171# ' Column expression. If joinExpr is omitted, join() wil perform a Cartesian join
11721172# ' @param joinType The type of join to perform. The following join types are available:
11731173# ' 'inner', 'outer', 'left_outer', 'right_outer', 'semijoin'. The default joinType is "inner".
@@ -1303,7 +1303,7 @@ setMethod("except",
13031303# ' @param source A name for external data source
13041304# ' @param mode One of 'append', 'overwrite', 'error', 'ignore'
13051305# '
1306- # ' @rdname write.df
1306+ # ' @rdname write.df
13071307# ' @export
13081308# ' @examples
13091309# '\dontrun{
@@ -1401,7 +1401,7 @@ setMethod("saveAsTable",
14011401# ' @param col A string of name
14021402# ' @param ... Additional expressions
14031403# ' @return A DataFrame
1404- # ' @rdname describe
1404+ # ' @rdname describe
14051405# ' @export
14061406# ' @examples
14071407# '\dontrun{
@@ -1444,7 +1444,7 @@ setMethod("describe",
14441444# ' This overwrites the how parameter.
14451445# ' @param cols Optional list of column names to consider.
14461446# ' @return A DataFrame
1447- # '
1447+ # '
14481448# ' @rdname nafunctions
14491449# ' @export
14501450# ' @examples
@@ -1465,7 +1465,7 @@ setMethod("dropna",
14651465 if (is.null(minNonNulls )) {
14661466 minNonNulls <- if (how == " any" ) { length(cols ) } else { 1 }
14671467 }
1468-
1468+
14691469 naFunctions <- callJMethod(x @ sdf , " na" )
14701470 sdf <- callJMethod(naFunctions , " drop" ,
14711471 as.integer(minNonNulls ), listToSeq(as.list(cols )))
@@ -1488,16 +1488,16 @@ setMethod("na.omit",
14881488# ' @param value Value to replace null values with.
14891489# ' Should be an integer, numeric, character or named list.
14901490# ' If the value is a named list, then cols is ignored and
1491- # ' value must be a mapping from column name (character) to
1491+ # ' value must be a mapping from column name (character) to
14921492# ' replacement value. The replacement value must be an
14931493# ' integer, numeric or character.
14941494# ' @param cols optional list of column names to consider.
14951495# ' Columns specified in cols that do not have matching data
1496- # ' type are ignored. For example, if value is a character, and
1496+ # ' type are ignored. For example, if value is a character, and
14971497# ' subset contains a non-character column, then the non-character
14981498# ' column is simply ignored.
14991499# ' @return A DataFrame
1500- # '
1500+ # '
15011501# ' @rdname nafunctions
15021502# ' @export
15031503# ' @examples
@@ -1515,14 +1515,14 @@ setMethod("fillna",
15151515 if (! (class(value ) %in% c(" integer" , " numeric" , " character" , " list" ))) {
15161516 stop(" value should be an integer, numeric, charactor or named list." )
15171517 }
1518-
1518+
15191519 if (class(value ) == " list" ) {
15201520 # Check column names in the named list
15211521 colNames <- names(value )
15221522 if (length(colNames ) == 0 || ! all(colNames != " " )) {
15231523 stop(" value should be an a named list with each name being a column name." )
15241524 }
1525-
1525+
15261526 # Convert to the named list to an environment to be passed to JVM
15271527 valueMap <- new.env()
15281528 for (col in colNames ) {
@@ -1533,19 +1533,19 @@ setMethod("fillna",
15331533 }
15341534 valueMap [[col ]] <- v
15351535 }
1536-
1536+
15371537 # When value is a named list, caller is expected not to pass in cols
15381538 if (! is.null(cols )) {
15391539 warning(" When value is a named list, cols is ignored!" )
15401540 cols <- NULL
15411541 }
1542-
1542+
15431543 value <- valueMap
15441544 } else if (is.integer(value )) {
15451545 # Cast an integer to a numeric
15461546 value <- as.numeric(value )
15471547 }
1548-
1548+
15491549 naFunctions <- callJMethod(x @ sdf , " na" )
15501550 sdf <- if (length(cols ) == 0 ) {
15511551 callJMethod(naFunctions , " fill" , value )
0 commit comments