romainfrancois commented on a change in pull request #8150:
URL: https://github.com/apache/arrow/pull/8150#discussion_r486283116



##########
File path: r/R/table.R
##########
@@ -185,6 +185,36 @@ Table <- R6Class("Table", inherit = ArrowObject,
   )
 )
 
+bad_attributes <- function(x) {
+  UseMethod("bad_attributes")
+}
+
+bad_attributes.default <- function(x) character()
+bad_attributes.data.frame <- function(x) c("class", "row.names", "names")

Review comment:
       And if we do that, we get to reconstruct grouped data frames as well: 
   
   ``` r
   library(arrow, warn.conflicts = FALSE)
   library(dplyr, warn.conflicts = FALSE)
   
   df <- data.frame(x = 1:10, g = rep(1:2, each = 5)) %>% group_by(g)
   as.data.frame(Table$create(df))
   #> # A tibble: 10 x 2
   #> # Groups:   g [2]
   #>        x     g
   #>    <int> <int>
   #>  1     1     1
   #>  2     2     1
   #>  3     3     1
   #>  4     4     1
   #>  5     5     1
   #>  6     6     2
   #>  7     7     2
   #>  8     8     2
   #>  9     9     2
   #> 10    10     2
   ```
   
   <sup>Created on 2020-09-10 by the [reprex 
package](https://reprex.tidyverse.org) (v0.3.0.9001)</sup>




----------------------------------------------------------------
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:
[email protected]


Reply via email to