Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/9029#discussion_r41592919 --- Diff: R/pkg/R/DataFrame.R --- @@ -1854,30 +1784,36 @@ setMethod("fillna", sdf <- if (length(cols) == 0) { callJMethod(naFunctions, "fill", value) } else { - callJMethod(naFunctions, "fill", value, as.list(cols)) + callJMethod(naFunctions, "fill", value, listToSeq(as.list(cols))) } dataFrame(sdf) }) -#' This function downloads the contents of a DataFrame into an R's data.frame. -#' Since data.frames are held in memory, ensure that you have enough memory -#' in your system to accommodate the contents. +#' crosstab #' -#' @title Download data from a DataFrame into a data.frame -#' @param x a DataFrame -#' @return a data.frame -#' @rdname as.data.frame -#' @examples \dontrun{ +#' Computes a pair-wise frequency table of the given columns. Also known as a contingency +#' table. The number of distinct values for each column should be less than 1e4. At most 1e6 +#' non-zero pair frequencies will be returned. #' -#' irisDF <- createDataFrame(sqlContext, iris) -#' df <- as.data.frame(irisDF[irisDF$Species == "setosa", ]) +#' @param col1 name of the first column. Distinct items will make the first item of each row. +#' @param col2 name of the second column. Distinct items will make the column names of the output. +#' @return a local R data.frame representing the contingency table. The first column of each row +#' will be the distinct values of `col1` and the column names will be the distinct values +#' of `col2`. The name of the first column will be `$col1_$col2`. Pairs that have no +#' occurrences will have zero as their counts. +#' +#' @rdname statfunctions +#' @name crosstab +#' @export +#' @examples +#' \dontrun{ +#' df <- jsonFile(sqlCtx, "/path/to/file.json") +#' ct = crosstab(df, "title", "gender") #' } -setMethod("as.data.frame", --- End diff -- also for this from a recent PR
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org