Bug 15940 - Rprofile file not read under MAC OS 10.9.4
Summary: Rprofile file not read under MAC OS 10.9.4
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: Startup (show other bugs)
Version: R 3.1.1
Hardware: x86_64/x64/amd64 (64-bit) OS X Mavericks
: P5 major
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-08-19 16:56 UTC by Adam Hausknecht
Modified: 2014-08-21 17:27 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Hausknecht 2014-08-19 16:56:21 UTC
i,

I've installed R in a math computer classroom and need a method to automatically load additional packages beyond the default packages:

1. The package manager does not remember checked packages to load between sessions.

2. Also, R does not seem to read the .Rprofile file located in a user's home directory when R starts. Thus, R does not read and execute a .First function.

3. I've also tried to use an Rprofile.site file in the subdirectory etc but
that does not seem to be read either!

In short their does not seem to be a way to change the default packages
that are loaded when R starts under Mac OS 10.9.4. 

Regards,

Adam Hausknecht
Department of Mathematics
UMass Dartmouth
Comment 1 Peter Dalgaard 2014-08-19 17:33:00 UTC
This works for me. Looks like at least your analysis is wrong; .Rprofile _is_ read and run. 

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.1.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[1] "Hi!"
[R.app GUI 1.65 (6784) x86_64-apple-darwin13.1.0]

> system("cat ~/.Rprofile")
print("Hi!")
>
Comment 2 Adam Hausknecht 2014-08-20 14:01:54 UTC
(In reply to Peter Dalgaard from comment #1)
> This works for me. Looks like at least your analysis is wrong; .Rprofile
> _is_ read and run. 
> 
> R version 3.1.1 (2014-07-10) -- "Sock it to Me"
> Copyright (C) 2014 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin13.1.0 (64-bit)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
> 
>   Natural language support but running in an English locale
> 
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
> 
> [1] "Hi!"
> [R.app GUI 1.65 (6784) x86_64-apple-darwin13.1.0]
> 
> > system("cat ~/.Rprofile")
> print("Hi!")
> >

Dear Peter Dagaard,

Thanks for your quick response!

Here is the output from my MacBook Pro running Mac OS 10.9.4:

-----------------------------------------------------------------------------------
R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.1.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[R.app GUI 1.65 (6784) x86_64-apple-darwin13.1.0]

[Workspace restored from /Users/ahausknecht/.RData]
[History restored from /Users/ahausknecht/.Rapp.history]

>  system("cat ~/.Rprofile")
print("Hi")
> 
---------------------------------------------------------------------------------------

As you can see  the line 

 [1] Hi! 

is missing. But the Rprofile file containing the print statement is present in my home directory!
 
I'm not sure what to do to fix the problem! 
Perhaps there is some R environment variable that is missing or is not set correctly.


Regards,

Adam Hausknecht
Department of Mathematics
UMass Dartmouth
Comment 3 Simon Urbanek 2014-08-20 14:16:17 UTC
Please check your preferences - R.app allows you to override the startup directory which would also override the location of .Rprofile. If it doubt, you can reset your preferences to the default settings by renaming or deleting Library/Preferences/org.R-project.R.plist
Comment 4 Peter Dalgaard 2014-08-20 18:49:48 UTC
Hm, the workspace does seem to be restored from ~/.RData so presumably the Startup dir isn't changed?

Also check the environment. Having R_PROFILE set might explain it. (No idea how that would happen, but something clearly isn't normal.)