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 :
load("~/data.rda/data10.rda")
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
#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
load("testData.rda")
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 ~
Sys.getenv("HOME")
[1]"C:/Users/myUsername/Documents"
save(myData1, myData2, file = "~/testData.rda")
#File path "C:/Users/myUsername/Documents/testData.rda"
#This is the working directory
getwd()
[1]"C:/Users/myUsername/Documents/myRprojects/project1"
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")
#C:/Users/myUsername/Documents/myRprojects/project1/~testData.rda"
Hope this helps,
PJ
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)