convert rda to txt

hello, i would like to get a .txt with my .rda but i don't know how to do it, could you please help me

I receive this error directly :

Error in load("~/data.rda/data10.rda") :
mauvais numéro magique de restauration de fichier (le fichier est peut être corrompu) -- aucune donnée chargée
De plus : Warning message:
file ‘data10.rda’ has magic number 'Resou'
Use of save versions prior to 2 is deprecated

Error in save("~/data.rda/data10.rda") :
objet ‘~/data.rda/data10.rda’ introuvable

by the way the file in question is part of my project but I can't locate it with rstudio


Welcome to the RStudio community!

Here is a simple example how to save and load rda

#Generate some data
myData1 = data.frame(x = 1:100, y = runif(100))
myData2 = data.frame(x = LETTERS, y = runif(26))

#Save it as rda
save(myData1, myData2, file = "testData.rda")

#Load it again
  • Note that for saving, you can specify multiple objects you like to save by comma separating them, but you need to use the file = "fileName.rda" to set the file name.
  • Loading is just providing the path to the rda file.

I notice you are using the ~ in your path name. This is not the same as the working directory, but will default to the home folder on your disk. Use the getwd() to see the working directory, you can then save files relative to that one, or specify the full path.

#This is the home directory, so the ~

save(myData1, myData2, file = "~/testData.rda")
#File path "C:/Users/myUsername/Documents/testData.rda"

#This is the working directory

save(myData1, myData2, file = "myFolder/testData.rda")
#File saved in "C:/Users/myUsername/Documents/myRprojects/project1/myFolder/testData.rda"

#Incorrect use of ~, filename now starts with ~
save(myData1, myData2, file = "~testData.rda")

Hope this helps,

PS: You don't have to post a new reply if you want to add something to your original post, you can just edit it by clicking the little pencil icon in the bottom-right corner of your post (like I did for adding this comment)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.