Github user NarineK commented on a diff in the pull request: https://github.com/apache/spark/pull/8920#discussion_r40623123 --- 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 -- Or if the column is smth like : asc(df$col1) and we have another decreasing=False. This is going to be smth like: asc(asc(df$col1)) which doesn't make much sense.
--- 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