【发布时间】:2017-07-02 21:24:39
【问题描述】:
我有一个下面结构的数十个对象的列表。我想删除每个文件的前三行,只保留前三列。
x<-structure(c("", "Service", "", "HR", "", "", "Function", "", "Code",
"X1", "", "", "", "", "", "Doe, John", "Roe, Jane",
"Doe, Jane", "", "Full name", "", "", "", ""), .Dim = c(6L, 4L))
y<-structure(c("", "Service", "", "IT", "", "", "Function", "", "Code",
"X2", "", "", "", "", "", "Doe, Johnny", "Roe, Janette",
"Doe, Janette", "", "Full name", "", "", "", ""), .Dim = c(6L, 4L))
z<-structure(c("", "Service", "", "RD", "", "", "Function", "", "Code",
"X3", "", "", "", "", "", "Doe, Johnny", "Roe, Janette",
"Roe, Johnny", "", "Full name", "", "", "", ""), .Dim = c(6L, 4L))
l<-list(x,y,z)
如何用length(l) 概括列表中所有对象的下面写的内容?
length(l)
x<-bind_rows(
tbl_df(l[[1]][-c(1,2,3),c(1,2,3)]),
tbl_df(l[[2]][-c(1,2,3),c(1,2,3)]),
tbl_df(l[[3]][-c(1,2,3),c(1,2,3)])
)
【问题讨论】: