r – Error in eval(predvars, data, env) : invalid envir argument of type character

r – Error in eval(predvars, data, env) : invalid envir argument of type character

Use load directly

load(C:\pathToRDA\swiss.RDA)
#Assuming the dataset inside swiss.RDA is called swiss
simple.fit = lm(formula = VoteYes ~ age, data=swiss) 

dataset = load(C:\pathToRDA\swiss.RDA) will create a varible in the Values section called dataset in your Global env with a string vlaue swiss.

For example:

mtest = mtcats
save(mtest, file = mt.rda)
mtc = load(~/mt.RDA) #Will create variable called mtc = mtest in Values in Global env.  
load(~/mt.RDA) #loads the mtest dataset

r – Error in eval(predvars, data, env) : invalid envir argument of type character

Leave a Reply

Your email address will not be published.