Skip to content

How to convert .Rdata file into .csv or something else?

4 messages · y tanaka, John Kane, Jim Lemon +1 more

#
Dear mailing list members,

I am a beginner of this community.

I would like to analyze data in a .rdata file.
I ran the following code, but the object "d" remained empty.

d <- load("~/docdis/input/ch2/WV6_Data_R_v_2016_01_01.rdata")

I would like to know how to convert this file format into .csv or .txt.
I suppose this question is very basic, but I could not find solutions on
internet or in my textbooks.
I would appreciate it if someone would help me.

Yohei Tanaka (Tohoku University)
#
Welcome to the forum
.Rdata may contain many different objects.
I would suggest doing a? "ls()" to see what objects you have.
then have a look at ?write.table or ?write.csvThese commands will write many types of objects to a .csv file. 
For example if I have a data.frame called "dat1" I can write it to a csv (text) file like this:
write.csv(dat1, "~/Rjunk/mydata.csv")
On Thursday, August 17, 2017, 4:10:36 AM EDT, y tanaka <marineband2007 at gmail.com> wrote:
Dear mailing list members,

I am a beginner of this community.

I would like to analyze data in a .rdata file.
I ran the following code, but the object "d" remained empty.

d <- load("~/docdis/input/ch2/WV6_Data_R_v_2016_01_01.rdata")

I would like to know how to convert this file format into .csv or .txt.
I suppose this question is very basic, but I could not find solutions on
internet or in my textbooks.
I would appreciate it if someone would help me.

Yohei Tanaka (Tohoku University)

??? [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
#
Hi Yohei,
Were there any error messages that indicated that the file could not
be found? As you are using a *NIX operating system, remember that
".rdata" is not the same as ".Rdata". What does:

file.exists("~/docdis/input/ch2/WV6_Data_R_v_2016_01_01.rdata")

return?

Jim
On Thu, Aug 17, 2017 at 4:49 PM, y tanaka <marineband2007 at gmail.com> wrote:
#
On 17/08/2017 5:15 AM, John Kane via R-help wrote:
... and load() writes those directly into your workspace.  (You can 
control where it writes, but that's the default.)

Adding the "verbose = TRUE" argument to load() will tell you what you've 
just read.
The variable d should have contained the names of objects from that 
file.  If it was empty, then something went wrong.

Duncan Murdoch