-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(r): Support matrix objects as fixed-size-list arrays (#692)
Still needs some testing on the stream case, and is unfortunately not very zero copy; however, gets the job done (and I think fixes some cases where we would have otherwise silently handled a matrix as the storage type). Inspired by #691! ``` r library(nanoarrow) df <- data.frame(x = 1:10) df$matrix_col <- matrix(letters[1:20], ncol = 2, byrow = TRUE) array <- as_nanoarrow_array(df) # Default comes back as list_of(character()) convert_array(array) |> tibble::as_tibble() #> # A tibble: 10 × 2 #> x matrix_col #> <int> <list<chr>> #> 1 1 [2] #> 2 2 [2] #> 3 3 [2] #> 4 4 [2] #> 5 5 [2] #> 6 6 [2] #> 7 7 [2] #> 8 8 [2] #> 9 9 [2] #> 10 10 [2] # But can specify matrix convert_array( array, tibble::tibble(x = integer(), matrix_col = matrix(character(), ncol = 2)) ) #> # A tibble: 10 × 2 #> x matrix_col[,1] [,2] #> <int> <chr> <chr> #> 1 1 a b #> 2 2 c d #> 3 3 e f #> 4 4 g h #> 5 5 i j #> 6 6 k l #> 7 7 m n #> 8 8 o p #> 9 9 q r #> 10 10 s t ``` <sup>Created on 2024-12-12 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup>
- Loading branch information
1 parent
7b8a7c8
commit 1eaa8d5
Showing
15 changed files
with
329 additions
and
28 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.