我想计算通过a_9_1,a_9_2,a_9_3到a_9_16的标头标识的几列的rowMean。我正在使用的代码是
df$em<-rowMeans(df[,c(paste("a_9",seq(1,16,1, sep="_"))], na.rm=T)
但是它给了我以下错误信息:
Error in `[.data.table`(df, , c("a_9", seq(1, 16, 1, sep = "_"))) :
column(s) not found: a_9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
In addition: Warning message:
In seq.default(1, 16, 1, sep = "_") :
extra argument ‘sep’ will be disregarded
我将不胜感激。