[R] Memory limit in Aggregate()

Guillaume guillaume_bs at hotmail.com
Wed Aug 3 16:20:28 CEST 2011


Hi Peter,
Thanks for these information.
I used a column concatenating the listBy data to do this aggregation : (I
don't know if it's the best solution, but it seems to work).

aggregateMultiBy <- function(x, by, FUN){
	tableBy = data.frame(by)
	tableBy$byKey = ""
	for(colBy in names(by))
		tableBy$byKey = paste(tableBy$byKey, as.character(tableBy[,colBy]),"")
	
	tableOut <- aggregate(	x = x
					,	by = list(byKey = tableBy$byKey)
					,	FUN = FUN)
	tableOut <- merge(	x = tableOut
				,	y = tableBy
				,	by = "byKey")

	tableOut$byKey <- NULL
	return(tableOut)
}

Thanks again,
Guillaume

--
View this message in context: http://r.789695.n4.nabble.com/Memory-limit-in-Aggregate-tp3711819p3715633.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list