0

I have tried a number of different configurations, and just don't have the time to keep looking through examples. I saw this thread .Rprofile not sourced and hoped it would have the answer. The problem might be because I am working on a Windows system and it seemed that posting referred to a Mac OS. I have an R project and in the same working directory I tried adding the ".Rprofile.txt" file. I have tried the following syntax: "Rprofile", "RProfile", ".Rprofile", and ".RProfile". I have been able to run the file using source() and that seemed to work. In the link above, it mentioned needing the trailing newline character. I tried that on a separate line, at the end of the script, and at the end of the script with a space. I cannot figure out what the nuance is that I am not picking up. Can someone please help? This is my script:

print("The stringsAsFactors have been disabled. We are loading some common libraries")
suppressMessages(require(xlsxjars))
suppressMessages(require(xlsx))
suppressMessages(require(purrr))
suppressMessages(require(crayon)) \n

Lastly, I insterted the print() statement so I could see if the script was being picked up. That isn't happening. Thanks for your help in advance, and I am sorry, but without examples the other postings don't quite fix the problem.

Phil
  • 7,287
  • 3
  • 36
  • 66
DeCodened
  • 59
  • 2
  • 8
  • On Windows it's `Rprofile.site`, in the `etc` folder. – Rui Barradas Apr 28 '20 at 06:17
  • One last note; I tried running ```options("defaultPackages"=pkgs)``` and that was after installing the packages that were added to the string of "pkgs". Such packages were those like "purrr" or "xlsx" and I still didn't see those added after specifying. Maybe there is some odd configuration I need to set up? – DeCodened Apr 28 '20 at 06:43
  • @RuiBarradas thank you, but can't you create a specific "Rprofile" in the same working directory that will override the "Home" directory? I tried using "Rprofile.site" in the naming convention just now, but to no avail. – DeCodened Apr 28 '20 at 06:46

1 Answers1

0

I was fortunate enough to find the answer here How to access and edit Rprofile? and when I ran the file.edit(".Rprofile") and was able to add the .Rprofile script in the source window. Thanks @Rui Barradas for the tip, it helped me find the answer. I noticed after saving in the source window, an actual .Rprofile file was saved in the working directory. This can always be edited with file.edit().

DeCodened
  • 59
  • 2
  • 8