Displaying 1 result from an estimated 1 matches for "grp_".
Did you mean:
grp
2008 Mar 04
1
help needed on function call
...<- function(dt,var,grp,grpcnt){
xx<-freqtot(dt,var)
for(i in 1:grpcnt) {
assign(paste("x",i,sep=""),subset(dt,grp==i))
df<-eval(parse(text=paste("x",i,sep="")))
yy <- freqtot(df,cat1);
names(yy)<-c("Group",paste("grp_",i,"_cnt",sep=""),paste("grp_",i,"_pct",sep=""))
xx<-merge(xx,yy,by.x="Group",all=TRUE)
}
print(xx)
}
The output is
> xyz <- freqgrp(dt,cat1,ind,2)
Group cnt pct grp_1_cnt grp_1_pct grp_2_cnt grp_2_pct
1 0 38...