haven icon indicating copy to clipboard operation
haven copied to clipboard

Interaction between `.name_repair` and `col_select`

Open olivroy opened this issue 2 years ago • 1 comments

Hi,

The .name_repair and col_select arguments of the read_*() functions do not interact correctly.

  df <- data.frame(1:3, 1:3)
  colnames(df) <- c("id", "id")
  path <- tempfile()
  write_sas(df, path)

read_sas(path, .name_repair = "universal", col_select = c(id...1))
Error in df_parse_sas_file(spec_data, spec_cat, encoding = encoding, catalog_encoding = catalog_encoding,  : 
  attempt to set index 1/1 in SET_STRING_ELT

In the readr package, this behaviour works.

olivroy avatar Jun 27 '22 13:06 olivroy

Thanks @olivroy! Will check it out.

Related to #685

gorcha avatar Jul 01 '22 03:07 gorcha