[R] Real Basic Question
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Thu Sep 26 19:06:48 CEST 2019
On 26/09/2019 12:55 p.m., Phillip Heinrich wrote:
> Just when I think I’m starting to get the hang of R I run into something that sends me back to Go without collecting $200.
>
> The working directory seems to be correct when I load an .rda file but it is not there and it is not in the Global Environment in the upper right hand window in RStudio.
> getwd()
> [1] "C:/Users/Owner/Documents/Baseball/RetroSheetDocumentation"
>> load("~/Baseball/RetroSheetDocumentation/ari18.test2.rda")
>> ari18.test2
> Error: object 'ari18.test2' not found
>> ls()
> [1] "ari18.test3" "array1" "array2" "BaseballArticles" "BaseballArticles2"
> [6] "BaseballArticles3" "BBCorpus" "BBtdm" "firstfunction" "folder"
> [11] "h" "matrix" "matrix2" "matrix3" "n"
> [16] "seq" "testvector" "u" "vec" "x"
> [21] "y" "yourname"
>
>
> >
>
>
>
> Somehow ari18.test3 loaded but ari18.test2 will not.
>
> What am I missing here?
The filename (~/Baseball/RetroSheetDocumentation/ari18.test2.rda) has no
connection to the variables that would be created when you load it.
Finding out what's in that file isn't obvious: you need to load it into
an empty location (either your global environment in a clean new
session, or one created specially for the purpose). E.g.
env <- new.env()
load("~/Baseball/RetroSheetDocumentation/ari18.test2.rda", envir = env)
ls(envir = env)
This will load the object(s) from that file into the environment env.
You could copy them from there to somewhere else, use them from there,
or just load again into the global environment, now you know what you're
getting.
Duncan Murdoch
More information about the R-help
mailing list