Minha lista:
structure(list(col1 = structure(list(a = 1:5, b = 1:5, c = 1:5), .Names = c("a",
"b", "c"), row.names = c(NA, -5L), class = "data.frame"), col2 = structure(list(
a = 6:10, c = 6:10), .Names = c("a", "c"), row.names = c(NA,
-5L), class = "data.frame"), col3 = structure(list(a = 11:15,
c = 11:15), .Names = c("a", "c"), row.names = c(NA, -5L), class = "data.frame"),
col4 = structure(list(a = 16:20, b = 16:20), .Names = c("a",
"b"), row.names = c(NA, -5L), class = "data.frame"), col5 = structure(list(
a = 21:25, c = 21:25), .Names = c("a", "c"), row.names = c(NA,
-5L), class = "data.frame")), .Names = c("col1", "col2",
"col3", "col4", "col5"))
Tentei:
res<-lapply(list,function(x)colSums(subset(x,select=c('a'))))
e
res<-lapply(list,function(x)colMeans(subset(x,select=c(1,2))))
e o resultado foi ok.
Mas, quando executo:
res<-lapply(list,function(x)shapiro.test(subset(x,select=c(1,2))))
não tenho sucesso (Error: is.numeric(x) is not TRUE
).
O que fazer?
colSums
ecolMeans
está tudo bem.