Setting the default folder in RStudio

You can set the default files folder in RStudio. Once the default folder is set, RStudio will point to it when started. The procedure to set the default folder differs slightly for Windows and Mac. 


Setting the default folder in Windows 

Before we set our default folder, create a folder for your working R files. One good location for this folder is in your Documents folder. Once you have created your R files folder, we can set RStudio to use that folder as its default storage location. For this example, I will put a folder named MATH-3200 in a folder named R that is in my home directory.

Use the Global Options Dialog to set the default folder. You can find the Global Options in the Tools menu of RStudio.

Figure 1 - RStudio Tools Menu


Click on Global Options menu choice. The Global Options dialog will open. 

Figure 2 - RStudio Global Options Dialog


Once the Global Options dialog opens look for the Default Working Directory option. In Figure 2 the Default Working Directory option is the second entry window. You can now use the Browse button to find the R files folder you created. For my example, I would search in the R folder and find my MATH-3200 folder. Select your R files directory and click the Select Folder button. The path to your R files folder is now entered in the window. Click the OK button and you are done. You can see that my example path shows in Figure 2. Now every time RStudio opens, you will have direct access to the files in your default directory. 


Setting the default folder in Mac 

Before we set our default folder, create a folder for your working R files. One good location for this folder is in your Documents folder. Once you have created your R files folder, we can set RStudio to use that folder as its default storage location. For this example, I will put a folder named MATH-3200 in a folder named R that is in my Documents Folder. 

Use the Preferences Dialog to set the default folder. You can find the Preferences in the RStudio menu of RStudio.

Figure 3 - Main RStudio Menu


Click on Preferences menu choice. The Preferences dialog will open.

Figure 4 - RStudio Preferences Dialog


Once the Preferences dialog opens look for the Default Working Directory option. In Figure 4 the Default Working Directory option is the first entry window. You can now use the Browse button to find the R files folder you created. For my example, I would search in the Documents folder and then in the R folder and find my MATH-3200 folder. Select your R files directory and click the Open button. The path to your R files folder is now entered in the window. Click the OK button and you are done. You can see that my example path shows in Figure 4. Now every time RStudio opens, you will have direct access to the files in your default directory.







Return to the R Learning Infrastructure Home Web Page