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
The id column should also be selectable in col_select()
#110
Comments
This is more advanced than other TDD issues, but if you are familiar with C or C++ should be fairly straightforward. The [id] argument needs to be passed to resolve_collectors and added to the column names used in |
So, was it intended that the id column must be in col_select? the id column seems to get unselected if not explicitly selected in col_select. library(readr); library(tibble)
#> Warning: package 'readr' was built under R version 4.0.5
#> Warning: package 'tibble' was built under R version 4.0.5
testcsv1 <- tibble(a = 1:3, b = 4:6, c = 7:9)
testcsv2 <- tibble(a = 1:3, b = 4:6, c = 7:9)
write_csv(testcsv1, "testcsv1.csv")
write_csv(testcsv2, "testcsv2.csv")
#read_csv(file = c("testcsv1.csv", "testcsv2.csv"), id = "file")
#read_csv(file = c("testcsv1.csv", "testcsv2.csv"), col_select = c("a","b"), id = "file")
#read_csv(file = c("testcsv1.csv", "testcsv2.csv"), col_select = c("a","b","file"), id = "file")
vroom::vroom(file = c("testcsv1.csv", "testcsv2.csv"), id = "file")
#> Rows: 6 Columns: 4
#> -- Column specification --------------------------------------------------------
#> Delimiter: ","
#> dbl (3): a, b, c
#>
#> i Use `spec()` to retrieve the full column specification for this data.
#> i Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 6 x 4
#> file a b c
#> <chr> <dbl> <dbl> <dbl>
#> 1 testcsv1.csv 1 4 7
#> 2 testcsv1.csv 2 5 8
#> 3 testcsv1.csv 3 6 9
#> 4 testcsv2.csv 1 4 7
#> 5 testcsv2.csv 2 5 8
#> 6 testcsv2.csv 3 6 9
vroom::vroom(file = c("testcsv1.csv", "testcsv2.csv"), col_select = c("a","b"), id = "file")
#> Rows: 6 Columns: 2
#> -- Column specification --------------------------------------------------------
#> Delimiter: ","
#> dbl (2): a, b
#>
#> i Use `spec()` to retrieve the full column specification for this data.
#> i Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 6 x 2
#> a b
#> <dbl> <dbl>
#> 1 1 4
#> 2 2 5
#> 3 3 6
#> 4 1 4
#> 5 2 5
#> 6 3 6
vroom::vroom(file = c("testcsv1.csv", "testcsv2.csv"), col_select = c("a","b","file"), id = "file")
#> Rows: 6 Columns: 3
#> -- Column specification --------------------------------------------------------
#> Delimiter: ","
#> dbl (2): a, b
#>
#> i Use `spec()` to retrieve the full column specification for this data.
#> i Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 6 x 3
#> a b file
#> <dbl> <dbl> <chr>
#> 1 1 4 testcsv1.csv
#> 2 2 5 testcsv1.csv
#> 3 3 6 testcsv1.csv
#> 4 1 4 testcsv2.csv
#> 5 2 5 testcsv2.csv
#> 6 3 6 testcsv2.csv Created on 2022-03-08 by the reprex package (v2.0.1) |
Created on 2019-05-14 by the reprex package (v0.2.1)
The text was updated successfully, but these errors were encountered: