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 COMMENTlink
written 2.4 years ago by Nitin90
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 REPLYlink modified 2.4 years ago • written 2.4 years ago by David W3.5k
How is this relevant to bioinformatics? This question is more suitable for StackOverflow.
ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by Zev.Kronenberg8.2k
off topic, read the manual
ADD REPLYlink written 2.4 years ago by Michael Dondrup28k


Sukhdeep Singh5.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