12

I want to add some customization to my .Rprofile. However, I cannot seem to find the file.

Many have said it is located in my ~/ folder. I have unhidden all my hidden files and do not seem to find it. Also looked in R.Frameworks.

Not finding anything. I assume that I have one, as R fires up and works fine.

Any other search methods?

My system is Mac OSX 10.8, R 3.0, RStudio

mpg
  • 3,679
  • 8
  • 36
  • 45
  • 2
    if there isn't one, just create it. `touch ~/.Rprofile` – baptiste Jul 03 '13 at 22:54
  • ok. Just write in a text file or some other document type? Then put in in ~/ ? – mpg Jul 03 '13 at 22:55
  • 1
    yep. this file is _optional_. Note that the document type should be plain text, and with no file extension obviously. – baptiste Jul 03 '13 at 22:55
  • @flodel. There may be a duplicate somewhere, but that's not it. If a dup does exist, it is probably tagged with a [osx] tag. This is really a question about a) is .Rprofile necessary [No] as well as b) how to see/build it [mac-specific instructions needed]. – IRTFM Jul 03 '13 at 23:12
  • @baptiste thanks for the info. Since so many people have spoken about that file- I just assume I must have one. So, I will create this and see what occurs. Very kind. – mpg Jul 03 '13 at 23:17

4 Answers4

17

my favorite way would be to open a Terminal window, and type:

touch ~/.Rprofile
open ~/.Rprofile

or

open -a Textedit ~/.Rprofile

this way you save yourself from a) the possibility of overwriting an existing file that you didn't find; b) fiddling with the way the Finder hides/shows system files; c) problems with overzealous text editors/OS that insist on adding file extensions, or don't like system files.

baptiste
  • 75,767
  • 19
  • 198
  • 294
1

since you are using OS X:

in text edit -

  • new file
  • put in whatever you'd like to have in your rprofile
  • Format > Make Plain Text (or CMD+SHIFT+T )
  • Save File ** IMPORTANT: un-select the option to add ".txt"
  • Save the file as .Rprofile (it will give you a warning, say yes)
Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178
0

Terminal:

cd <wherever your R stuff is> [enter]

grep -r "some_string_you_know_exists_in_.Rprofile" [enter]

This will recursively search the directory and all subdirectories for any files containing the string in quotations

mikedugan
  • 2,393
  • 3
  • 19
  • 24
0

Your .Rprofile file may not exist. It's not necessary. If it does exist, then the Finder.app hides it (as well as hiding the .RHistory file), since it thinks its a "system file". You can force Finder.app to always display system files by executing this in a Terminal session. (This is how I run my box.) I guess you already did something like this?

defaults write com.apple.Finder AppleShowAllFiles YES

# After running  <pt>-<click-hold> on Dock-Finder-icon, choose relaunch

Running with this does require the discipline of never deleting system files unless you really know all their dependencies. Then you can create a .Rprofile file and edit it when you want to add something. Going back to the safe version would use the obvious modification.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • to look I did this in the terminal: defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder But still found nothing. – mpg Jul 03 '13 at 23:15
  • Even better. It is possible to have multiple .Rprofile files with different working directories. – IRTFM Jul 03 '13 at 23:17