Working in R exclusively through the command line is rarely appropriate in practice, except when running short and simple commands (such as those introduced in this chapter) or when experimenting with new functions. For more complicated operations, we will save our code to a file in order to have the capability, for example, to work on it on several instances or to share it with other users. This section introduces approaches to editing and saving R code.
Typing the expression
5+5 into the command line was easy enough. However, if we perform more complicated operations, we'll have to edit and save our code for later use. There are three main approaches to edit R code: