Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend col_select to data.frame and data resources #197

Open
peterdesmet opened this issue Mar 27, 2024 · 0 comments
Open

Extend col_select to data.frame and data resources #197

peterdesmet opened this issue Mar 27, 2024 · 0 comments
Labels
enhancement New feature or request function:read_resource Function read_resource()
Milestone

Comments

@peterdesmet
Copy link
Member

col_select is currently only passed to readr::read_delim() and as a result only works for loading CSV resources. As mentioned in #162 (comment) it makes sense to also apply it to data and df resources for consistency:

library(dplyr)
library(frictionless)
p <-
  create_package() %>%
  add_resource("plants", data = PlantGrowth)
read_resource(p, "plants")
#> # A tibble: 30 × 2
#>    weight group
#>     <dbl> <fct>
#>  1   4.17 ctrl 
#>  2   5.58 ctrl 
#>  3   5.18 ctrl 
#>  4   6.11 ctrl 
#>  5   4.5  ctrl 
#>  6   4.61 ctrl 
#>  7   5.17 ctrl 
#>  8   4.53 ctrl 
#>  9   5.33 ctrl 
#> 10   5.14 ctrl 
#> # ℹ 20 more rows
read_resource(p, "plants", col_select = c("group"))
#> # A tibble: 30 × 2
#>    weight group
#>     <dbl> <fct>
#>  1   4.17 ctrl 
#>  2   5.58 ctrl 
#>  3   5.18 ctrl 
#>  4   6.11 ctrl 
#>  5   4.5  ctrl 
#>  6   4.61 ctrl 
#>  7   5.17 ctrl 
#>  8   4.53 ctrl 
#>  9   5.33 ctrl 
#> 10   5.14 ctrl 
#> # ℹ 20 more rows

Created on 2024-03-27 with reprex v2.1.0

@peterdesmet peterdesmet added enhancement New feature or request function:read_resource Function read_resource() labels Mar 27, 2024
@peterdesmet peterdesmet added this to the 1.2.0 milestone Mar 27, 2024
@peterdesmet peterdesmet modified the milestones: 1.2.0, 1.3.0 Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request function:read_resource Function read_resource()
Projects
None yet
Development

No branches or pull requests

1 participant