Skip to content
Prev 9018 / 15075 Next

.First for R.app called twice?

On May 16, 2012, at 7:09 PM, R. Michael Weylandt wrote:

            
No, since the GUI is interactive -- note that the GUI doesn't do anything to the R afterwards. If we did not support changing working directories on document open we could start R without any flags. Another possible "fix" would be to run R with --no-profile and source it by hand, but I already feel bad about the somewhat strange sequence and the user typically wants to run .Rprofile from the home directory and not the dropped one.
The only reason I called it a hack is that we need to store a copy of the first .First so we can compare it after the workspace is loaded. But at least this way .First is guaranteed to run once (unless you change .First in .First() in which case it will still run twice anyway ...) - so it may not be that bad ;).

Cheers,
Simon