Search code examples
ruser-interfacesaverstudio

How does RStudio save and export files?


I'm new to RStudio. So far I managed to import my data from a csv file and write some code in order to manipulate it abit.

Now, I want to do the following things:

  1. Save my whole project so that later I can pick it as is.

  2. Export the dataframe (marked in blue) back to csv so I can open it in another program.

I'm trying to find how to do these in the RStudio GUI without writing a code for that. Tried fiddling with the same icons (marked in black) but none made sense to me. What is the difference between the left and right save icon?

All the guides I'v seen relay on code only. Can someone explain in a human language how can I accomplish my two goals?

enter image description here


Solution

    1. When you have set up a Project (File -> New Project or File -> Open Project), your files and loaded variables are saved when you close RStudio. You can also click on the save button on the right of your screen, in the Environment tab (the right save button, as you call it).

    2. I don't think there is a graphical way to export variables from Rstudio. The command is quite straight-forward: write.csv(variable, filename, row.names=F)

    3. The left save buttons are for saving the actual script you are working in. In your example, this is the file whole_save.R. The right save button is for saving your environment (that is, open files, loaded variables, loaded libraries).