tidyverse / readxl

Read excel files (.xls and .xlsx) into R 🖇

Home Page:https://readxl.tidyverse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Excel column names or RC reference as default names in read_excel

mkoohafkan opened this issue · comments

Reading in an excel range with col_names = FALSE results in uninformative name creation messages:

d = read_excel(my_book, my_sheet, "A1:C6", col_names = FALSE)

#> New names:
#> • `` -> `...1`
#> • `` -> `...2`
#> • `` -> `...3`

Neither the message or the resulting names are helpful or clear. However, it should be simple to derive appropriate default names from the workbook columns and/or RC notation, both of which result in valid names:

  • A1:C6 --> "A", "B", "C"
  • R1C1:R6C3 --> "C1", "C2", "C3"

You could also generate default row names using this logic.

Duplicate of #522