The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Kirk Fleming (2) [Avatar] Offline
#1
I have an Rprofile.site file (running XP) that R finds, reads, then spits back with the following:
"File U:/rhome/Rprofile.site contains invalid line(s)
ls()
They were ignored."

Doesn't seem to matter what I put in the file, I get the same error. I've tried 3 different editors (Notepad, RStudio and UltraEdit).
I've tried ensured that 1) there is no carriage return, 2) there IS a carriage return, 3) the function return is assigned ("test1 <- ls()"smilie and 4) the return is not assigned.

Regardless of what code I put in the file, the file is read correctly--that is, the error spits back exactly the correct code as-written.

What obscure syntactical or procedural nuance am I missing?
Kirk Fleming (2) [Avatar] Offline
#2
Re: R doesn't like any Rprofile.site file
This has been resolved, although I don't have a full understanding of why.

Initially, I believe I'd provided sufficient environment variable definition, etc., that R could find the file and open it. However, I don't believe I'd ever actually set the R_PROFILE environment variable in in R as part of R startup.

Eventually, I used R_ENVIRON in Windows XP to point to an Renviron.site file, and within that file, set R_PROFILE to the complete path and filename of Rprofile.site. This resolved the problem and the Rprofile.site executes as expected.