Github user NarineK commented on a diff in the pull request: https://github.com/apache/spark/pull/8920#discussion_r40639413 --- Diff: R/pkg/R/DataFrame.R --- @@ -1848,3 +1848,67 @@ setMethod("crosstab", sct <- callJMethod(statFunctions, "crosstab", col1, col2) collect(dataFrame(sct)) }) + +#' Sort +#' +#' Sort a DataFrame by the specified column(s). +#' +#' @param x A DataFrame to be sorted. +#' @param by A character column indicating the field to sort on +#' @param decreasing Orderings for each sorting column +#' @param ... Additional sorting fields +#' @return A DataFrame where elements are sorted by input sorting columns. +#' @rdname sort +#' @name sort +#' @aliases orderby +#' @export +#' @examples +#'\dontrun{ +#' sc <- sparkR.init() +#' sqlContext <- sparkRSQL.init(sc) +#' path <- "path/to/file.json" +#' df <- jsonFile(sqlContext, path) +#' sort(df, TRUE, "col1","col2") +#' sort(df, decreasing=TRUE, "col1") +#' sort(df, decreasing=c(TRUE,FALSE), "col1","col2") +#' } +setMethod("sort", + signature(x = "DataFrame"), + function(x, decreasing=FALSE, col, ...) { --- End diff -- Well, I added similar to arrange now.... for sort it is a little more difficult with the signature and input arguments. It should comply with R's signature and it shouldn't brake the existing one. I cannot explicitly specify the column types in the signature... This is braking the actual sort function. I did play a lot with all possible combinations I could have thought of, so that I don't brake the sort{base} since you also use it in other places in SparkR.
--- 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