Startup and Closing Behavior
-
Starting R: The R GUI versions, including RStudio, under Windows and Mac OS X can be opened by double-clicking their icons. Alternatively, one can start it by typing
R
in a terminal (default under Linux). -
Startup/Closing Behavior: The R environment is controlled by hidden files in the startup directory:
.RData
,.Rhistory
and.Rprofile
(optional). -
Closing R:
q()
Save workspace image? [y/n/c]:
- Note:
When responding with
y
, then the entire R workspace will be written to the.RData
file which can become very large. Often it is sufficient to just save an analysis protocol in an R source file. This way one can quickly regenerate all data sets and objects.
Navigating directories
Create an object with the assignment operator <-
or =
object <- ...
List objects in current R session
ls()
Return content of current working directory
dir()
Return path of current working directory
getwd()
Change current working directory
setwd("/home/user")