How can I properly build an lapply to read (from out of one directory) all the .csv files, load all the columns as strings and then bind them into one data frame.
Per this, I have a way to get all the .csv files loaded and bound into a dataframe. Unfortunately they are getting hung up on the variablity of how the columns are getting type cast. Thus giving me this error:
Error: Can not automatically convert from character to integer in
files = list.files(pattern="*.csv")
tbl = lapply(files, read_csv(files, col_types = cols(.default = "c")))
lapply should be the form
lapply(x, FUN, ...) where
... is the arguments passed to
FUN. You're filling the arguments within FUN. It should be
lapply(files, read_csv, col_types = cols(.default = "c"))
If you like a
files %>% map_df(~read_csv(.x, col_types = cols(.default = "c")))
Which will bind the whole thing into a data frame at the end.