I am trying to combine two .rda files into one .rda file. I've only been able to call one .rda files data and the second one isnt coming up. Also, the .rda's I've generated are too small to contain all the data I need. This is the general code I am using:
## load .rda files
object1 <- load(paste("dir_to_rda", sep=","))
object2 <- load(paste("dir_to_rda", sep=","))
## folder
try(dir.create("foldername"),TRUE)
writeto <- function(x) file.path("outputs_all",x)
## combine
combine12 <- rbind(object1, object2)
save(combine12,file=writeto(sprintf("%s-combine12.rda",Project)))
Please let me know what is incorrect, I am new to R so I am sure there are a few things that need to be fixed.
Thank you!
A few things, the "load" function takes a filename as an argument however you seem to be pointing to a directory. Second, in the "save" function, I think you meant to put Project in quotes as Project is currently an undefined variable.
What happens if you simplify things and try the following just to see if the data is properly imported and saved:
object1 <- load("file1.rda")
object2 <- load("file2.rda")
combine12 <- rbind(object1, object2)
save(combine12, file="<full path and filename to output file>")
Hope this helps!