You are currently offline, waiting for your internet to reconnect

Setting the default R working directory on startup

Automatically setting the default working directory is a bit different in Revolution R than it is in CRAN-R. Because the Revolution IDE has its own startup and initialization sequence, you need to set any R commands you want to use in a .First function that is called in a local .Rprofile on startup.

The contents of this .First function might look as follows:

User-specific .Rprofile:

.First <- function(){
   rCodeDir <<- "C:/MyRdir"
   setwd(rCodeDir)
   source("C:/MyRdir/startup.R")
   cat("\nWelcome at", date(), "\n")



Here the file 'startup.R' is a further R script that contains the following commands:

library(nws)
library(KernSmooth)

 

The steps to create this kind of configuration are the following:

1). Using 'Notepad' or your favorite editor, create a file named .Rprofile with the above content.
    (Note that this file begins with a 'period' in the name and DOES NOT have a file extension)
    If you are using Notepad choose 'File ---> Save As'. As the 'File Type' select 'All Files'(*.*).
    Do not save the file with a (*.txt) file extension).

   Save this file into the directory 'C:\MyRdir'.

   Also save the file 'startup.R' with the above contents in this same folder.
  

2).  Launch Revolution R Enterprise. After opening the program, goto 'Tools ---> Options ---> Revolution RPE Options --> Load last solution at startup'
      and verify that it is set to 'False'. Change it if it is set to 'True'.
      Also verify that the option 'Automatically run .Rprofile' is set to 'True'. Change it if it is set to 'False'.

 
3).  Create a Windows icon shortcut on your desktop to:

      C:\Revolution\R-Enterprise-7.0\IDE64\RevoIDE.exe


4).  Create a directory on your computer that contains the .Rprofile file, let's say:

      C:\MyRdir


5).  Edit the properties of the Windows icon shortcut. Change the 'Start in:' field of the shortcut
     so it says:   C:\MyRdir

     Click 'Apply' and 'OK' to change the shortcut settings.


6). Double-click the shortcut to launch Revolution R Enterprise in the future.
     All your startup settings should be applied and the default working directory should now be changed.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 3103291 - Last Review: 10/26/2015 08:35:00 - Revision: 1.0

Revolution Analytics

  • KB3103291
Feedback
html>cript>