[BlindRUG] R Questions

Godfrey, Jonathan A.J.Godfrey at massey.ac.nz
Sun Mar 7 07:04:26 UTC 2021


Hello Niels,

I used to put the selection of my preferred CRAN mirror in the R profile.

Back when I was helping make sure a set of windows machines in a computer lab next to my office played nicely for the students, I would do some things that are less necessary now that almost everyone (else) uses RStudio. That was before RStudio existed so there was no cloud server at position 1 on the list that came up for students. I hard coded which CRAN mirror our lab machines looked at.

Before tab completion, typing the full command to choose the CRAN mirror was irritating enough to want it automatically set for me all the time. That then featured in the profile for the folder I used just for maintaining my R installation.

Other things I did over the years lowered in importance.
I did switch the pager to notepad, I did have to force help in HTML (now standard) and toyed with cosmetic things at various times

Henrik's warnings seem interesting, but I can't think of situations when I shorten arguments. I do need to watch that I name arguments when showing sample code to my students though.

Jonathan


-----Original Message-----
From: BlindRUG <blindrug-bounces at nfbnet.org> On Behalf Of Niels Luithardt via BlindRUG
Sent: Sunday, 7 March 2021 7:03 PM
To: Blind R Users Group <blindrug at nfbnet.org>
Cc: Niels Luithardt <niels.luithardt at googlemail.com>
Subject: Re: [BlindRUG] R Questions

Hello Henrik,

Thank you very much for your answer. I would be very interested to know what you have adjusted in the Rprofile file.

In my file it's just a few settings. For example, I replaced the non-accessible pager with notepad. I would be very happy about further recommendations!

Kind regards

Niels




2021-03-07 3:04 GMT+01:00, Henrik Bengtsson via BlindRUG <blindrug at nfbnet.org>:
> Regarding:
>
>> 1. On windows, the default global R profile is part of the installation.
>> Each time I update R, the profile is in the wrong place and needs moving.
>> I did do that occasionally but that was years ago now.
>
> So, you must have ended up editing the "site-wide" Rprofile one, that 
> comes with the R Windows installation, e.g.
> C:/PROGRA~1/R/R-40~1.4/etc/Rprofile.site.  A good rule of thumb is to 
> never edit or add anything to the folder where R itself is installed.
> I never had to do that during the two decades I've use R.
>
> A better option is to use a folder-specific or a user-specific 
> .Rprofile file.  Those ones will survive R upgrades since they live 
> under you home folder.  When R starts, it looks for a .Rprofile file 
> in the following order: If .Rprofile exists in the current folder 
> where R is started, then that is sourced during the R startup process.
> If that doesn't exist, then it looks for .Rprofile in your home
> folder.   The latter is by far most commonly used one by people. BTW,
> the format of this file must be a valid R script with a trailing 
> newline.  If you forget the newline at the end, R will silently ignore 
> the file (which is such an annoying misfeature).
>
> One MS Windows, it is a bit confusing what R considers to be your home 
> folder.  It is not C:\Users\alice\ as one would expect.  Instead, it 
> is C:\Users\alice\Documents\.  That is vhere you want to put your 
> .Rprofile file in order for R to source it every time you start R 
> regardless from where you start R and regardless which version of R 
> you start.  The easiest way to find the exact location is to do the 
> following from within R:
>
>> normalizePath("~/.Rprofile")
> [1] "C:\\Users\\alice\\Documents\\.Rprofile"
>
> That is the file you want to create.  I have such a file on my machine 
> and I had it there for many years.  I use it for different things, 
> e.g. tweaking the prompt, tweaking R option warnPartialMatchArgs=TRUE 
> to remind me to not use partial argument names, and so on.
>
> Hope this helps,
>
> Henrik
>
> On Sat, Mar 6, 2021 at 3:03 PM Godfrey, Jonathan via BlindRUG 
> <blindrug at nfbnet.org> wrote:
>>
>> Hello Niels,
>>
>> I seldom adjust the R profile nowadays. I have several reasons.
>>
>> 1. On windows, the default global R profile is part of the installation.
>> Each time I update R, the profile is in the wrong place and needs moving.
>> I did do that occasionally but that was years ago now.
>> 2. I might edit the copy of the r profile in a specific work folder, 
>> but again, the usefulness to me has reduced. The reason relates to 
>> your next question.
>>
>> You will not edit an R script from the R terminal. It is just a plain 
>> text file though so you could edit it using any text editor of your choosing.
>> If you do this, you need to pull the script into the R session using 
>> `source()`, with the filename in the brackets as a quoted string. I 
>> do this very rarely nowadays.
>>
>> The use of R markdown has made the above all quite inefficient. I do 
>> practically all work inside an R markdown file because that speeds up 
>> the time to production of the final product I want to share. I only 
>> use the R prompt (terminal or GUI version) for little jobs or to get 
>> at help functionality.
>>
>> My data analysis workflow (today) is to
>>
>> 1. make a text file with the *.Rmd extension. I use WriteR and 
>> sometimes just plain old notepad. I might start from a blank file, a 
>> template, or sometimes using an old Rmd file that has a lot of what I want in it.
>> 2. If using WriteR, I process to html using the f5 key.
>> 3. if not using WriteR, I use rmarkdown::render() to process the file 
>> from the R terminal.
>> 4. to see my results, I open (and keep it open)  the html file step 2 
>> or 3 created, and refresh it as I update my Rmd file and re-process 
>> it. In most browsers that uses f5.
>>
>>
>> I still use R script files for package development of course. There 
>> are some rare occasions when an analysis job involves very long 
>> processing times and those tend to be done using an R script too, but 
>> that's mostly old habits.
>>
>>
>> HTH
>> Jonathan
>>
>> -----Original Message-----
>> From: BlindRUG <blindrug-bounces at nfbnet.org> On Behalf Of Niels 
>> Luithardt via BlindRUG
>> Sent: Sunday, 7 March 2021 6:13 AM
>> To: blindrug at nfbnet.org
>> Cc: Niels Luithardt <niels.luithardt at googlemail.com>
>> Subject: [BlindRUG] R Questions
>>
>> Hello,
>>
>> I have a few questions about the program R and hope you can help me.
>>
>> 1) Is it useful to customize the Rprofile file?
>>
>> 2) How can I open/run a script in RTerm?
>>
>> Kind regards
>>
>> Niels
>>
>> _______________________________________________
>> BlindRUG mailing list
>> BlindRUG at nfbnet.org
>> http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org
>> To unsubscribe, change your list options or get your account info for
>> BlindRUG:
>> http://nfbnet.org/mailman/options/blindrug_nfbnet.org/a.j.godfrey%40m
>> assey.ac.nz
>> The list archive can be viewed at:
>> http://www.nfbnet.org/pipermail/blindrug_nfbnet.org
>> More information and useful links about using R as a blind person can 
>> be obtained at:
>> http://R-Resources.massey.ac.nz
>>
>> Look for help using R commands by reading the accessible e-book 
>> "Let's Use R Now" compiled by Jonathan Godfrey at:
>> http://R-Resources.massey.ac.nz/lurn/front.html
>>
>> _______________________________________________
>> BlindRUG mailing list
>> BlindRUG at nfbnet.org
>> http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org
>> To unsubscribe, change your list options or get your account info for
>> BlindRUG:
>> http://nfbnet.org/mailman/options/blindrug_nfbnet.org/henrik.bengtsso
>> n%40gmail.com
>> The list archive can be viewed at:
>> http://www.nfbnet.org/pipermail/blindrug_nfbnet.org
>> More information and useful links about using R as a blind person can 
>> be obtained at:
>> http://R-Resources.massey.ac.nz
>>
>> Look for help using R commands by reading the accessible e-book 
>> "Let's Use R Now" compiled by Jonathan Godfrey at:
>> http://R-Resources.massey.ac.nz/lurn/front.html
>
> _______________________________________________
> BlindRUG mailing list
> BlindRUG at nfbnet.org
> http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org
> To unsubscribe, change your list options or get your account info for
> BlindRUG:
> http://nfbnet.org/mailman/options/blindrug_nfbnet.org/niels.luithardt%
> 40googlemail.com
> The list archive can be viewed at:
> http://www.nfbnet.org/pipermail/blindrug_nfbnet.org
> More information and useful links about using R as a blind person can 
> be obtained at:
> http://R-Resources.massey.ac.nz
>
> Look for help using R commands by reading the accessible e-book "Let's 
> Use R Now" compiled by Jonathan Godfrey at:
> http://R-Resources.massey.ac.nz/lurn/front.html
>

_______________________________________________
BlindRUG mailing list
BlindRUG at nfbnet.org
http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org
To unsubscribe, change your list options or get your account info for BlindRUG:
http://nfbnet.org/mailman/options/blindrug_nfbnet.org/a.j.godfrey%40massey.ac.nz
The list archive can be viewed at:
http://www.nfbnet.org/pipermail/blindrug_nfbnet.org
More information and useful links about using R as a blind person can be obtained at:
http://R-Resources.massey.ac.nz

Look for help using R commands by reading the accessible e-book "Let's Use R Now" compiled by Jonathan Godfrey at:
http://R-Resources.massey.ac.nz/lurn/front.html



More information about the BlindRUG mailing list