I am using this (ill advised, I know) solution to automatically name Excel files when uploading a folder.
temp = list.files(pattern="*.csv")
list2env(
lapply(setNames(temp, make.names(gsub("*.csv$", "", temp))),
read.csv), envir = .GlobalEnv)
Now, make.names
uses .
to make correct names, while I would rather use _
. What would be the best way to dynamically change the dots to underscores?
I tried to do something like lapply(ls(),gsub(".", "_"))
, but that does not seem to work.
I would also prefer to do it within list2env
, but I'll settle for a separate line.