Skip to content

tibble and gmp #1669

@neuwirthe

Description

@neuwirthe

Creating a tibble with a column of data type bigq from gmp does not work

Here is the reprex

library(tibble)
library(gmp)
#> 
#> Attaching package: 'gmp'
#> The following objects are masked from 'package:base':
#> 
#>     %*%, apply, crossprod, matrix, tcrossprod
tibble(x=as.bigq(0:2,2)) 
#> # A tibble: 40 × 1
#>    x     
#>    <bigq>
#>  1 0     
#>  2 1/2   
#>  3 1     
#>  4 NA    
#>  5 NA    
#>  6 NA    
#>  7 NA    
#>  8 NA    
#>  9 NA    
#> 10 NA    
#> # ℹ 30 more rows

Running the code in Rstudio produces the following output:

Error in `[<-`:
! Assigned data `map(.subset(x, unname), vectbl_set_names, NULL)` must be compatible with
existing data.
✖ Existing data has 40 rows.
✖ Assigned data has 188 rows.
ℹ Only vectors of size 1 are recycled.
Caused by error in `vectbl_recycle_rhs_rows()`:
! Can't recycle input of size 188 to size 40.
Run `rlang::last_trace()` to see where the error occurred.

Is it possible to make tibble work with bigq?

using data.frame, however, makes things work

library(gmp)
#> 
#> Attaching package: 'gmp'
#> The following objects are masked from 'package:base':
#> 
#>     %*%, apply, crossprod, matrix, tcrossprod
data.frame(x=as.bigq(0:2,2))
#>     x
#> 1   0
#> 2 1/2
#> 3   1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions