Printing results and saving data
We will explore the options available to take information stored within the R environment and express that information in either human- or machine-readable forms. We will start with a brief discussion on saving the workspace in an R environment. Next, we will discuss various commands that can be used to print information to either the screen or a file. Finally, we will discuss the primitive commands that can be used for basic file operations.
Saving a workspace
There are two commands used to save the information in the current workspace. The first is the save
command, which allows you to save particular variables. The second is the save.image
command, which allows you to save all the variables within the workspace.
The save
command requires a list of variables to save, and the name of a file to save the variables. There are a wide variety of options, but in the most basic form you simply save specific variables from the current workspace. Here, we use the ls...