Re: Problem with R-File

Jeff Newmiller via R-help <[email protected]> Wed, 18 Feb 2026 09:40:12 -0800
Newsgroups gmane.comp.lang.r.general
Message-ID <[email protected]>
There are many, many ways to save your work in R, and the "obvious" one 
(since R comes configured to automatically prompt you to do this) is to 
save your workspace in a file named ".RData" (note the period at the 
beginning) into whatever directory is the "current" directory at the 
time you quit. "IF" you then restart R with that directory as the 
current directory, it will reload those object automatically into memory.

Since there are different ways that people start and use R on different 
platforms, there are some challenges for anyone else on the list to tell 
you how you should proceed to find and load that data. One partial 
solution is you could restart R from any current directory and use:

load(file.choose())

which will bring up a file selection dialog box with which you can tell 
R where your file is.

However, you should know that people make mistakes, and saving an RData 
file will save any mistakes you make along with all your good data into 
a file where it is hard to see what is right and what is wrong. For this 
reason, most people using R take great care to keep the R commands that 
work properly in a text file with an .R extension (like 
"my_analysis.R"). This can be opened and run from top to bottom to 
re-load all those files you were working with to put your workspace back 
where it was, with the advantage that you can change any line in the 
file and re-run it to get a more correct result than you had before. 
Once you make this your normal way of using R, the helpful "prompt" to 
save your work in an .RData file becomes more of a nuisance than a help 
because you know how troublesome those files can be if they do happen to 
have a mistake... particularly since they get loaded automatically if 
there is nothing to the left of the period ("my_workspace.RData" will 
never get loaded automatically... only when you choose to load it).

Finally, please set your mail program to send plain text on the list, as 
the mailing list will mess up formatted (HTML) emails, so we won't see 
exactly what you see, no matter how nice you make it look on your 
screen. Read more in the Posting Guide mentioned at the bottom of every 
email on the mailing list.

Hello everyone,

>
> I have an problem with loading my data in R.
>
>
> When I wanted to continue working on my R-file today, I couldn't load it, even though I had saved it yesterday. Do you know how I can get the data set back?
>
>
> [https://download.mail.uni-siegen.de/owa/[email protected]/service.svc/s/GetFileAttachment?id=AAMkADdkOGJhZTU1LTk5MjYtNGE0ZS1iN2FkLWQ5NzNlMjQwMzU3MABGAAAAAAAIpVyi%2F1rSQb9Ri%2FjR4bhABwAi5fasp1aORKiJzHuBnrJCAAAAAAEJAAAi5fasp1aORKiJzHuBnrJCA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jLAk0vxFdLukRIKu7HmlMGUuOqTMTobOROcUgcyKGDCF0DkSwhg&owa=mail.uni-siegen.de&isImagePreview=True]
>
>
> I hope you can help me with my problem.
>
>
> Thanks and kind regards
>
> Volkan
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.