解析R列表中的值
我正在使用openxlsx从excel文件的多个工作表中读取数据。代码如下:解析R列表中的值,r,list,R,List,我正在使用openxlsx从excel文件的多个工作表中读取数据。代码如下: tfile <- "/home/mycomp/Documents/latest.xlsx" sheets <- openxlsx::getSheetNames(tfile) x <- lapply(sheets, function(X) openxlsx::read.xlsx(tfile, sheet = X,startRow=1, rows=1,cols=1,sep.names=" ")) t文件
tfile <- "/home/mycomp/Documents/latest.xlsx"
sheets <- openxlsx::getSheetNames(tfile)
x <- lapply(sheets, function(X) openxlsx::read.xlsx(tfile, sheet = X,startRow=1, rows=1,cols=1,sep.names=" "))
t文件问题是您有空的data.frame
s,您可以从中提取名称
x如何lappy(x,名称)
?谢谢……这很有效……unlist(lappy(x,名称))
…我可以接受你的答案。
> x
[[1]]
NULL
[[2]]
[1] Total Secondages
<0 rows> (or 0-length row.names)
[[3]]
[1] Product Groups (duration in secondages)
<0 rows> (or 0-length row.names)