我的代码如下
Fun2<-function(x){
x$dportfolio<-with(x, cut(x$coef,
breaks=quantile(x$coef, probs=seq(0,1, by=0.1), na.rm=FALSE),
include.lowest=TRUE,
labels=c("0","1","2","3","4","5","6","7","8","9")))
}
Data.1936.dsort.1<-aggregate(Data.1936.dsort,Data.1936.dsort$portfolio,FUN = Fun2)
我一直收到错误消息错误
in eval(substitute(expr), data, enclos = parent.frame()) :
invalid 'envir' argument of type 'character'
我想要做的是将这个功能应用于每个组,对于我创建子组的每个组