forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARROW-13371 [R] binding for make_struct -> StructArray$create()
This PR implements a binding for the `make_struct` compute function. This function was already being called in the translation for `case_when()` but didn't have a binding of its own. Because you can do this in dplyr too (create a nested data frame), I mapped `tibble()` and `data.frame()` since it can be tested using `compare_dplyr_binding()`. `StructArray$create()` is a nested call and is probably not that useful of a translation for dplyr users (I'd never think to use it). Basically, you can now do this: ``` r library(arrow, warn.conflicts = FALSE) library(dplyr, warn.conflicts = FALSE) df <- RecordBatch$create(a = 1, b = "two") df %>% mutate(df_col = tibble(a, b)) %>% collect() #> # A tibble: 1 × 3 #> a b df_col$a $b #> <dbl> <chr> <dbl> <chr> #> 1 1 two 1 two ``` Something I didn't do but could is add all the arguments of `tibble()` and `data.frame()` that aren't supported (e.g., `stringsAsFactors`). It seems like this is done for other translations but I just wanted to check! Closes apache#11690 from paleolimbot/r-make-struct Authored-by: Dewey Dunnington <dewey@fishandwhistle.net> Signed-off-by: Jonathan Keane <jkeane@gmail.com>
- Loading branch information
1 parent
e0f50e7
commit 73d6c4a
Showing
2 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters