$python wfe.py -i input.pcap -t csv > output.csv
在上述脚本上运行时,使用管道library(mirt)
library(psych)
df<-bfi
df<-mutate(df,group=cut(age,c(0,20,40,60,100)))
#workable
aggregate(df[, -which(names(df) %in% c("gender", "education", "age","group"))],by=list(df$group),FUN= mean)
#same function,not workable
df %>% aggregate(.[, -which(names(.) %in% c("gender", "education", "age","group"))],by=list(.$group),FUN= mean)
到同一功能时可以找到Error in mean.default(X[[i]], ...) : 'trim' must be numeric of length one
。
出什么问题了?
答案 0 :(得分:1)
没有示例数据,这是黑暗中的镜头。我认为问题与which
有关,如果我们首先select
,它会使捕获数据更加容易。我也是公式表示法的粉丝,因此也是用法。
iris %>%
.[-which(names(.)%in% c("Sepal.Length","Sepal.Width"))] %>%
aggregate(.~Species,.,FUN=mean)
Species Petal.Length Petal.Width
1 setosa 1.462 0.246
2 versicolor 4.260 1.326
3 virginica 5.552 2.026