Export files from rstudio

I want to export files from rstudio but I am facing a problem. When I save the files from the environment window ", it is saved in a format written on it R data file. And it saved by default as two copies. Also, when I click on setting to export the file, the export button is not exist. can you please help? Attached screenshot

You are using a desktop version of RStudio, there is no "export" option because the file is already in your local file system, there is no need to export it anywhere. That option is present on the RStudio server versions to export files from the server to your computer.

That is because you are saving the complete working environment not a single object, if you want to save a data frame as a csv file, use the write.csv() function.

Thank you for your help. But the files I have in my computer are different. I worked very much on the files on R and I want to have them on my computer for further analysis. Is there a way to get them dowloaded?

Again, those RData files are already in your computer, you are even showing that is the case in the screenshot you posted. You simply are looking for them in the wrong place.

Thanks again! you are right they are in my computer but I want to save the new analysed version. I tried write.csv() followed by file name but it is not working. Sorry it might be very simple but this is my first time using R studio. do you have any idea?

Can you show the exact command you are using? the write.csv() function requires two arguments, "x" should be the name of the data frame in memory that you want to save as a csv file and "file" is the path to the file that is going to be stored, for example, this would save the content of the daily data frame into the daily.csv file in your current working directory.

write.csv(x = daily, file = "daily.csv")

Thank you. I am using this code: write.csv(new_daily = daily, file = "daily.csv")

The write.csv() has no new_daily argument, the argument where you tell the function which data frame to save is called x (like in the example I gave you).

Okay, I run it now and I didn't get an error but I am not sure where and how it is saved. Sorry

It is being saved in your working directory.


to see what that is.

Thank you! I run it and it returned as below and I found it in the bin can. It is my first project using codes.
[1] "/Users/moblakah/.Trash/FitBit Fitness Tracker Data 17.51.12"

Thank you very much

Thank you very much!

The bin? That's very strange.

I'd suggest rebooting your computer, reloading R & **RStudio and running getwd() again to see what is your normal working directory. It should not be the trashbin!

You can change your working directory with setwd() in something like


If you are going to be doing fairly large projects using R it is a good idea to look into RStudio Projects. See RStudio Projects and Working Directories: A Beginner’s Guide | R-bloggers and /or 8 Workflow: projects | R for Data Science.

1 Like

Yes I also found it very strange. I will do as you recommended. Thanks again!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.