[R] Real Basic Question

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Fri Sep 27 15:01:09 CEST 2019



> On 26 Sep 2019, at 18:55 , Phillip Heinrich <herd_dog using cox.net> 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?


(1) getwd() is irrelevant if you load() a fully qualified filename
(2) if the file is actually in the working dir, load("ari18.test2.rda") should do
(3) there is no guarantee that an rda file contains an object of a name related to the file name 
(4) To see what is inside a .rda, try e <- new.env(); load("my.rda", e); ls(e)

-pd

> 
> Thanks.
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list