Displaying 1 result from an estimated 1 matches for "grpcnt".
2008 Mar 04
1
help needed on function call
...ifelse(dt$speed<15,1,2); #group variable;
freqtot <- function(data,var){
attach(data,warn.conflicts=FALSE)
x1 <- data.frame(table(var))
names(x1) <- c("Group","cnt")
x1$pct<-round(x1$cnt/nrow(data)*100,1)
return(x1)
}
freqgrp <- 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",se...