search for: myagg

Displaying 4 results from an estimated 4 matches for "myagg".

Did you mean: myagi
2012 Feb 03
1
incomplete final line found on <name of my sourced function file>
..."#99CCFF","#6495ED","#66CDAA","#EEC900","#BC8F8F", "#C00000","#696969","#473C8B","#8B4500", "#FF7F00","#9370DB", "#800000","#104E8B","#228B22")[20:1] myagg<-aggregate(indata[invars],by=indata[datesvar],FUN=myfunction) yrange=range(pretty(as.matrix(myagg[2:length(myagg)]))) if(fixedy==0){ ymin<-yrange[1] ymax<-yrange[2]} else { ymin<-0 ymax<-yrange[2]} ydistance<-ymax-ymin if(ydistance>0.1 & ydistance&lt...
2008 Oct 02
1
Help with aggregation
...1 1 0 1 2 1 1 2 1 1 3 0 0 3 0 0 library(Hmisc) myAgg<-summarize(Mcookie$c_we_conversion, by=Mcookie$user_id, FUN=max, na.rm=TRUE) names(myAgg)<- c("user_id","c_we_converter") Mcookie <- merge(Mcookie, myAgg, by.x = "user_id", by.y = "user_id") Thanks in advance, Mike [[alternative HTML version del...
2011 Oct 05
2
aggregate function with a dataframe for both "x" and "by"
...1=c(1,3,5,7,8,3,5,NA,4,5,7,9), testvar2=c(11,33,55,77,88,33,55,NA,44,55,77,99) ) mybys=data.frame(mbn1=c('red','blue',1,2,NA,'big',1,2,'red',1,NA,12),mbn2=c('wet','dry',99,95,NA,'damp',95,99,'red',99,NA,NA) , stringsAsFactors =F) myaggs <- data.frame(matrix(data=NA, nrow=nrow(mydata), ncol=ncol(mydata) ) ) for(i in 1: ncol(mydata) ) { temp <- aggregate(mydata[i], by = as.list(mybys[i]), FUN=sum, na.rm=T) rownums <- match(mybys[,i],temp[,1]) myaggs[,i] <- temp[rownums,2] } myaggs Finally, how do I convert...
2004 Aug 16
1
turning off automatic coersion from list to matrix
...gregate behavior I like: aggregate(a[,"num"],by=list(product=a[,"product"],region=a[,"region"]), sum) Now in reality I have more columns than just product and region, and need to pick different combinations. So I want to abstract this into a function. Example use: myagg(a,c("product","region")) But I am having trouble because by= requires a list and apply and sapply seem to cast things back to the "matrix" type automatically. Can I turn this off? Eg: data.class(sapply(c("product","region"),function(i) {a[,i]}...