ianmcook commented on a change in pull request #10261: URL: https://github.com/apache/arrow/pull/10261#discussion_r627893108
########## File path: r/R/record-batch.R ########## @@ -148,13 +148,20 @@ RecordBatch$create <- function(..., schema = NULL) { if (length(arrays) == 1 && inherits(arrays[[1]], c("raw", "Buffer", "InputStream", "Message"))) { return(RecordBatch$from_message(arrays[[1]], schema)) } + # Else, list of arrays # making sure there are always names if (is.null(names(arrays))) { names(arrays) <- rep_len("", length(arrays)) } stopifnot(length(arrays) > 0) + # Preserve any grouping + if (length(arrays) == 1 && inherits(arrays[[1]], "grouped_df")) { + out <- RecordBatch__from_arrays(schema, arrays) + return(group_by(out, !!!groups(arrays[[1]]))) Review comment: dplyr is not in Arrow's Depends or Imports, so we need to use `dplyr::` before `group_by` and other dplyr functions. This line will error if dplyr is not installed, but that's reasonable because it's enclosed in a conditional that should prevent it from being run in most cases where dplyr is not installed ```suggestion return(dplyr::group_by(out, !!!dplyr::groups(arrays[[1]]))) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org