I need to convert an rda file to csv. I've tried to load it in R , but I get the following error:
In readChar(con, 5L, useBytes = TRUE) :
cannot open compressed file file 'data/matrix.rda', probable reason 'No such file or directory'
Here is a link to rda file (http://elisacarli.altervista.org/matrix.rda)
Thanks in advance for any suggestion
for starters, if your data is at that url, you needs to open a connection to the url and then load the .rda file:
con <- url('http://elisacarli.altervista.org/matrix.rda')
load(con)
close(con)
if you have the file on your computer, then just:
load('[full path to file]/matrix.rda')
this should create and object called 'matrix', see what is in it by typing:
matrix
then you would use this function:
write.csv(matrix,file="mysavefile.csv")
This appears to be an issue of not having the object you are trying to write out to your csv in your working environment. Did you load your .RDA file first? I was able to load your .RDA file into my R session and write it out the LDH.aap.ave object with write.csv()
with no apparent problems.
I recommend you check:
ls()
. Presumably, the contents of your .RDA file will not be in here. For cleanliness, maybe you want to clear your working environment first and start fresh? rm(list=ls())
will do the trick for you there.getwd()
setwd()
load("my.RDA")
ls()
. I see one object in the attached .RDA file named "LDH.aap.ave"head()
, str()
, summary()
are your friends here.write.csv(LDH.aap-ave, file = "myFileName.csv")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With