我正在尝试使用来自Rmisc
包的summarySE
函数为工作簿中的每一列生成数据摘要。工作表中的第一列是分组变量,我想循环遍历其他列。
我正在使用以下代码:
library(Rmisc)
for(i in 2:ncol(file)){
sum<-summarySE(file, measurevar = file[,i], groupvars = file[1])
}
但是我一直在收到相同的错误信息:
'Error in UseMethod("as.quoted") :
no applicable method for 'as.quoted' applied to an object of class
"data.frame"'
我知道file[1]
是一个列表,应该是一个向量,但使用unlist
会引起更多的问题。有什么想法吗?
数据:
structure(list(Treatment = c("SKELE", "SKELE", "SKELE", "SKELE",
"SKELE", "SKELE", "SKELE", "SKELE", "SKELE", "SKELE", "SKELE",
"SKELE", "TISSUE", "TISSUE", "TISSUE", "TISSUE", "TISSUE", "TISSUE",
"TISSUE", "TISSUE", "TISSUE", "TISSUE", "TISSUE", "TISSUE"),
`% lipid in skeleton` = c(21.8706902567934, 31.1736436075643,
62.2246234617322, 86.6248675033794, 46.5607971373041, 34.7532319115317,
32.7686161366371, 6.73685660233744, 33.7111477556584, 48.8970450055359,
54.3687328279357, 48.9086732773318, 78.1293097432066, 68.8263563924357,
37.7753765382678, 13.3751324966206, 53.4392028626959, 65.2467680884683,
67.2313838633629, 93.2631433976626, 66.2888522443416, 51.1029549944641,
45.6312671720643, 51.0913267226682), `% ash in skeleton` = c(97.370981485225,
98.6169174273543, 99.2417548180554, 99.1330769035889, 98.5523872323069,
98.0077944962001, 97.7848485294277, 98.0738823145836, 98.1567971208113,
98.8047064451889, 97.1790753033603, 98.7503991978965, 2.62901851477497,
1.38308257264571, 0.75824518194458, 0.866923096411125, 1.44761276769314,
1.99220550379987, 2.2151514705723, 1.92611768541643, 1.84320287918869,
1.19529355481109, 2.82092469663973, 1.24960080210352), `% tissue in skeleton` = c(55.2224357342865,
70.022864703591, 77.5880978578982, 83.1168129092154, 67.3012504898307,
62.1455896726595, 64.2488985210074, 67.3089347382539, 59.9276126303114,
70.5681668501146, 67.717146912379, 68.8185249866557, 44.7775642657135,
29.977135296409, 22.4119021421018, 16.8831870907846, 32.6987495101694,
37.8544103273405, 35.7511014789926, 32.6910652617461, 40.0723873696886,
29.4318331498854, 32.2828530876211, 31.1814750133443)), class = "data.frame", row.names = c(NA,
-24L), .Names = c("Treatment", "% lipid in skeleton", "% ash in skeleton",
"% tissue in skeleton"))