+1 vote
1 view
in R Programming by (5.3k points)
edited by

I made a data.frame in R that is not very big, but it takes quite some time to build. I would like to save it as a file, which I can then again open in R?

2 Answers

+2 votes
by (25.4k points)
edited by

To save a data frame to a file in R, use the save() function from the base package as follows:


This file will be saved in your current working directory.

To print the current working directory:


To set the working directory:


To load the saved data frame:


If you want to learn more about R programming watch this tutorial on Introduction to Data Science with R 

0 votes
by (107k points)

Let’s suppose your DataFrame is named as df so you can write the CSV file as follows:


After the above step you can load the CSV file easily:


An alternate method for this is will be as follows:


You can load the dataframe by the following way:


Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !