r-lib / vctrs

Generic programming with typed R vectors
https://vctrs.r-lib.org
Other
287 stars 66 forks source link

Return data frames of class `c("tbl", "data.frame")` #1383

Open lionel- opened 3 years ago

lionel- commented 3 years ago

To get nice printing when tibble is loaded:

vctrs::new_data_frame(
  list(x = list(1, 2)),
  class = "tbl"
)
#> # A data frame: 2 × 1
#>   x
#>   <list>
#> 1 <dbl [1]>
#> 2 <dbl [1]>
DavisVaughan commented 2 years ago

Consider vec_count() output, i.e. #1632

lionel- commented 2 years ago

If it turns out to be too confusing to print dfs like tibbles (but after some practice in rlang I think it's fine), we can just improve the print method in pillar, e.g. we could have a "base" qualifier in bold red in the header.

DavisVaughan commented 2 years ago

Potential set of candidates

vec_count
vec_split
vec_group_loc
vec_locate_sorted_groups
vec_unrep

# this would be fine as a base data frame,
# always returns integer columns, but may be a candidate
vec_locate_matches