Which R function saves a workspace in RStudio?

Which of the following statements about writing code in the file editor and the console are true? Select two.

1) The file editor is used to write and save R code.
2) The console is used to execute R code.
3) The file editor is used to execute R code.
4) The console is used to write and save R code.

Answer :

In RStudio, the function save.image() is used to save a workspace. The file editor is for writing and saving R code, while the console executes R code. True statements about RStudio coding are numbers 1 and 2.

The R function used to save a workspace in RStudio is save.image(). This function captures the current working environment and saves it to a file. The default filename is ".RData", but you can specify a different name if you wish.

Writing code in RStudio involves the use of both the file editor and the console. Statement 1 is true: the file editor is used to write and save R code, which can be identified by the .R extension (script files). Coding in the editor allows you to write, edit, save and execute chunks of code or entire script files. To execute a line or selection of code from the editor, you can click 'Run' or press CTRL+ENTER, which sends the code to the console for execution.

Statement 2 is also true: the console is used to execute R code. In the console, you can enter commands directly and have R execute them instantly.

Therefore, the correct statements regarding RStudio's functionality are numbers 1 and 2, denoting the uses of the file editor and the console respectively.