第五天始衅,復(fù)雜了復(fù)雜了。议双。痘番。
關(guān)于數(shù)據(jù)結(jié)構(gòu),要學(xué)要練的還有很多平痰,比如這個(gè)save函數(shù)汞舱,為什么報(bào)錯(cuò)呢?因?yàn)樽兞縓沒(méi)有在test.RData中先賦值宗雇?
save(X,file="test.RData")
Error in save(X, file = "test.RData") : object ‘X’ not found
正確的用法是:
x <- stats::runif(20)
y <- list(a = 1, b = TRUE, c = "oops")
save(x, y, file = "xy.RData") # creating "xy.RData" in current working directory, 保存其中部分變量
save.image() # creating ".RData" in current working directory, 保存當(dāng)前所有變量
Save R Objects
Description
save
writes an external representation of R objects to the specified file. The objects can be read back from the file at a later date by using the function load or attach (or data in some cases).
save.image()
is just a short-cut for ‘save my current workspace’, i.e.,save(list = ls(all.names = TRUE), file = ".RData", envir = .GlobalEnv)
. It is also what happens with q ("yes")`.