我正在尝试将以下内容保存在我的工作目录中:
ALPHABETA <- structure(c(0, 0.0094, 0.003, -0.0018, -5e-04, 0.0042, 0, -0.1842,
-0.0672, 0.3856, -0.3433, -0.0937, 0, 0.8424, 0.5915, 0.3092,
0.1996, 0.4278, 0, -0.0033, 0.0027, -0.0056, 0.0052, -0.0018,
NaN, 0.9886, 0.2486, 0.6784, 0.984, 0.9863, NaN, 0.1273, 0.0211,
0.9116, 0.3237, 0.4026), .Dim = c(6L, 6L), .Dimnames = list(c("DGS6MO",
"A.Adjusted", "AA.Adjusted", "AAME.Adjusted", "AAN.Adjusted",
"AAON.Adjusted"), c("ALPHAdn", "BETAup", "BETAdn", "ALPHAup",
"UPpval", "DNpval")))
但是,对于filename
部分,我正在尝试使用/粘贴以下字符向量作为名称:
DATES1 <- c("199907/199912")
我有一个循环,将经历几个DATES1
(实际DATES1向量的长度要大得多)但是因为这是第一次迭代,所以:
ii = 1
saveRDS(ALPHABETA, file=paste0("",DATES1[ii], ".rds"))
然后我收到以下错误:
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file '199907/199912.rds', probable reason 'No such file or directory'
如何使用ALPHABETA
向量使用saveRDS()
保存DATES1
?