Creating R Dataset


Hi all,
I want to create dataset in R so that i load into R session as follows
data(mydatasetname)
I tried following
values<- read.table("mydatasetname.txt") save(values,file="value.rda")
but wen i type following command to load data
data(values)
Warning message: In data(values) : data set ‘values’ not found
Can anybody help
Nitin
R
ADD COMMENT • link •
written 2.4 years ago by Nitin • 90
Sukhdeep has the right answer, data() is really for getting datasets from packages or the standard library in R. Just so you know, if you do create a package then plain text tables are one of of the formats that you can use in the /data directory (as per the documentation) - i.e. there is no reason to save your data in the binary format
ADD REPLY • link modified 2.4 years ago • written 2.4 years ago by David W ♦ 3.5k
How is this relevant to bioinformatics? This question is more suitable for StackOverflow.
ADD REPLY • link modified 2.4 years ago • written 2.4 years ago by Zev.Kronenberg ♦ 8.2k
off topic, read the manual
ADD REPLY • link written 2.4 years ago by Michael Dondrup ♦ 28k


Sukhdeep Singh ♦ 5.4k
Germany
You read a table in a variable named values
values<- read.table("mydatasetname.txt")
you saved a image as an .rda (Rdata) file
save(values,file="value.rda")
To load it , use the load command as load('value.rda')
This will load the image you saved capturing the table you read. To confirm, type ls() which will list the values variable and typing it will output the values stored in it. Also, the data command is to load the data provided by default with the packages, so if you write data(), it will give you a list existing datasets.
HTH
Cheers

No comments:

Post a Comment