I am trying to incorporate the name of the month in the name of the variable being stored.
import <- function(month) {
  dataobj <- letters
  assign("x", dataobj)
  save("x", file="data.rda")
}
works. But the following doesn't work -
import <- function(month) {
  dataobj <- letters
  assign(substr(month, 1, 3), dataobj)
  save(substr(month, 1, 3), file="data.rda")
}
It seems that save() will accept "x" but not substr(month, 1, 3).
Any ideas how to fix this?
Use the list argument of save():
save(list=substr(month,1,3), file="data.rda")
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With