[ https://issues.apache.org/jira/browse/ARROW-18049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nicola Crane updated ARROW-18049: --------------------------------- Parent: ARROW-18181 Issue Type: Sub-task (was: Improvement) > [R] Support column renaming in col_select argument to file reading functions > ---------------------------------------------------------------------------- > > Key: ARROW-18049 > URL: https://issues.apache.org/jira/browse/ARROW-18049 > Project: Apache Arrow > Issue Type: Sub-task > Components: R > Reporter: Nicola Crane > Priority: Major > Labels: good-first-issue > > We should support the ability to rename columns when reading in data via the > CSV/Parquet/Feather/JSON file readers. > We currently have an argument {{col_select}}, which allows users to choose > which columns to read in, but renaming doesn't work. > To implement this, we'd need to check if any columns have been renamed by > {{col_select}} and then updating the schema of the object being returned once > the file has been read. > {code:r} > library(readr) > library(arrow) > readr::read_csv(readr_example("mtcars.csv"), col_select = c(not_hp = hp)) > #> # A tibble: 32 × 1 > #> not_hp > #> <dbl> > #> 1 110 > #> 2 110 > #> 3 93 > #> 4 110 > #> 5 175 > #> 6 105 > #> 7 245 > #> 8 62 > #> 9 95 > #> 10 123 > #> # … with 22 more rows > arrow::read_csv_arrow(readr_example("mtcars.csv"), col_select = c(not_hp = > hp)) > #> # A tibble: 32 × 1 > #> hp > #> <int> > #> 1 110 > #> 2 110 > #> 3 93 > #> 4 110 > #> 5 175 > #> 6 105 > #> 7 245 > #> 8 62 > #> 9 95 > #> 10 123 > #> # … with 22 more rows > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)