Question: Is it possible to read R objects from an RData file only if they don't exist in the current environment?
Why: I'd like to be able to set some variables at the top of an R script, but load in a previous script's finished variables. If they are set at the top, though, I'd like them to override the load()
variables.
Example data and problem:
a <- 5
b <- 2
save(a,b,file="testa.RData")
rm(a)
a <- 10
load("testa.RData")
#CURRENTLY:
> a
[1] 5
> b
[1] 2
#DESIRED RESULT:
> a
[1] 10
> b
[1] 2