R projects

note you will not be expected to use R projects for MES 503. This introduction is for your own convenience and project management.

An R Project is a complete workspace. It allows you to manage multiple files, datasets, scripts, and other related assets, and provides an easy way to return to those projects at a later time.


How to create an R Project

  1. Launch RStudio.

  2. Navigate to File -> New Project.

  3. Specify the desired location for your project.

  4. Choose the components to include, such as an existing directory or version control options.


To reopen a previously created R Project, you can use either of the “standard” methods:

  1. double-click the associated .Rproj file in your file explorer.

  2. in RStudio, File -> Open Project.


Advantages for your Thesis Research (or other projcets)


R Environments

An R environment is essentially a snapshot of your current R session. It encompasses various objects you’ve created, ranging from data frames, vectors, and matrices to custom functions and plots.


Saving Your Environment

To preserve your current R environment and safeguard your progress:

  1. Use the save.image() function.
# Saving the current R environment to a .RData file
save.image("my_environment.RData")

Restoring a Saved Environment

To pick up where you left off:

  1. Use the load() function.
# Loading a saved R environment from a .RData file
load("my_environment.RData")

Advantages