[R] Setting .Rprofile for RStudio on a Windows 7 x64bit

Henrik Bengtsson henrik.bengtsson at gmail.com
Wed Apr 19 21:38:59 CEST 2017


I'd be really surprised if basically not all text editors could be
used here; it more that some have quirks making it less obvious.  For
instance, with plain old Notepad that comes with all Windows distros
you can put (double) quotes around the file name in the Save As...
dialog to prevent Notepad from adding it's own default *.txt extension
(when the extension is missing).  BTW, since you're using RStudio, you
can also use that to create your .Rprofile file; RStudio's Save As...
does not mess with the filename - it saves the file as you specify.

Bruce, what I think would have helped helping you here early on is if
you had given a bit more details on what you did / tried.  There was a
lot of "does not work" early on, which gives little clues.  It wasn't
clear where you saved the files.  Maybe you weren't sure yourself, but
even knowing so would have helped help you.  It was also not clear how
much experience you had with R, which caused confusion - knowing "new
to R, with non professional programming skills" would probably have
cut some corners.  As a helper, here and on other forums, it's often
hard to guess this and to provide a proper reply is then hard - like
trying to give a scientific presentation when you don't know who's in
the audience.  This happens all the time and most people quickly picks
up what the expectations are and then get a smoother ride going
forward.

/Henrik

PS. With the risk of adding confusion, unless you already do so, you
should focus on only using/editing your
C:/Users/BruceRatner/Documents/.Rprofile (also referred to as
~/.Rprofile) file.  That one does not require any Administrative
rights to edit and has the advantage of working also when you update R
later.   The C:/PROGRA~1/R/R-33~1.3/etc/.Rprofile.site file requires
Admin to edit and will have to be recreated/reedited whenever you
update R (e.g. R 3.4.0 will install in a different directory).  A
regular R user should never have to edit the latter.  It's mostly used
for system admins who wish to set common startup settings for multiple
users in a location file.  The *.site part of .Rprofile.site suggests
site-wide settings.  So, use ~/.Rprofile to control your R startup
settings.


On Tue, Apr 18, 2017 at 8:26 AM, Bruce Ratner PhD <br at dmstat1.com> wrote:
> Dear John:
> My pleasure to respond to your request.
> Problem: Cannot get the .Rprofile file to take affect in either R (or RStudio).
> As to "what" can be in put into a  .Rprofile file is abound, many examples in the manuals, blogs, links, and books.
>
> The "how to" write the file was the real issue, not clearly covered in any material I could find or purchase.
>
> I read that any notepad-type app can be used to create the .Rprofile file:
> 1. with or without a txt/R extension, and/or
> 2. with or without Administrator permission.
>
> Not being a professional programmer/developer, I did not know about text editors that can create files with no extension, which was the problem at hand.
>
> After many back and forth drilling down by R-helpers with trouble shooting queries, it became clear that I was not using a developer's text editor.
>
> Solution: I found an editor online, EditPad Pro 7 (for Windows), with which I created my .Rprofile file.
>
> The result was complete success, and gratitude to all R-helpers who stuck by me,
> understanding I am new to R, with non professional programming skills. As a statistician (or if you prefer data scientist) for twenty plus years, clearly I must know how to program, but not at the pro level or pro understanding.
>
> John, I hope this write up is satisfactory, if not please let let me know, as I will rewrite until you are happy with it.
>
> It is a nice surprise to hear your wanting to archive the problem-solution, which almost did me in, and which created ill feelings among several R-helpers towards me.
>
> Regards,
> Bruce
>
> ______________
> Bruce Ratner PhD
> The Significant Statistician™
> (516) 791-3544
> Statistical Predictive Analytics -- www.DMSTAT1.com
> Machine-Learning Data Mining -- www.GenIQ.net
>
>
>
>> On Apr 18, 2017, at 9:52 AM, Sparks, John James <jspark4 at uic.edu> wrote:
>>
>> Bruce,
>>
>> Do you think that you could post the final solution to the problem?  That
>> way it would be stored with this thread and the next person who has the
>> same problem would be able to locate the FINAL solution.
>>
>> --JJS
>>
>>
>>> On Mon, April 17, 2017 12:47 pm, BR_email wrote:
>>> TO _ALL_:
>>> THANK YOU. THANK YOU. THANK YOU.
>>> After hours, and hours, and hours, and ... , and hours: Success.
>>> To all who helped, thanks.
>>> My quest was minor, but major for me, as I learn from the path of one,
>>> whether big or small begets another.
>>>
>>> I never look down at anyone, except to help him/her up.
>>>
>>> With gratitude,
>>> Bruce
>>>
>>> Bruce Ratner, Ph.D.
>>> The Significant Statistician™
>>> (516) 791-3544
>>> Statistical Predictive Analtyics -- www.DMSTAT1.com
>>> Machine-Learning Data Mining and Modeling -- www.GenIQ.net
>>>
>>>
>>> Peter Dalgaard wrote:
>>>>> On 17 Apr 2017, at 19:01 , BR_email <br at dmstat1.com> wrote:
>>>>>
>>>>> Berend: Something looks good, but RStudio still Rprofile still doees
>>>>> not affect the launch.
>>>>>
>>>>>> source(echo=TRUE, "C:/Users/BruceRatner/Documents/.Rprofile.site")
>>>>>> options(prompt="R> ")
>>>>>> set.seed(12345)
>>>>>> rm(list=ls())
>>>>> R>
>>>>>
>>>>>
>>>>> Bruce Ratner, Ph.D.
>>>>> The Significant Statistician™
>>>>> (516) 791-3544
>>>>> Statistical Predictive Analtyics -- www.DMSTAT1.com
>>>>> Machine-Learning Data Mining and Modeling -- www.GenIQ.net
>>>>>
>>>>> Berend Hasselman wrote:
>>>>>> source(echo=TRUE, ""C:/Users/BruceRatner/Documents/.Rprofile.site")
>>>> According to the gospel of St.Henrik, that filename is wrong, and
>>>> possibly the directory too.
>>>>
>>>> So try his suggestions. What is the output (show us!) of
>>>>
>>>> normalizePath("./.Rprofile")
>>>> normalizePath("~/.Rprofile")
>>>>
>>>> Assuming that the former is
>>>>
>>>> "C:/Users/BruceRatner/Documents/.Rprofile"
>>>>
>>>> you could try renaming the .Rprofile.site file to that. If need be, use
>>>> file.rename, as in
>>>>
>>>> file.rename(from="C:/Users/BruceRatner/Documents/.Rprofile.site",
>>>> to="C:/Users/BruceRatner/Documents/.Rprofile")
>>>>
>>>> (and restart, obviously).
>>>>
>>>> [I wouldn't set the seed in a .Rprofile file, nor would I use rm()
>>>> there, but that is a different kettle of fish.]
>>>>
>>>
>>> ______________________________________________
>>> R-help at 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.
>>
>>
>>
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list