Loops are time consuming in R. Try one of the apply functions for vectorized calculations, like "apply", "lapply","sapply" or "tapply". Also see help for "split".
In a message dated 10/19/03 5:25:51 PM Pacific Daylight Time, [EMAIL PROTECTED] writes: > Hello All, > I am new to R. I am trying to process this huge data set of > matrix containing four columns, say x1, x2, x3, x4 and n number of rows. > > I want to aggregate the matrix by x1 and perform statistic based on > columns x2, x3, x4. I tried aggregate function but it gave me memory > allocation error (which I am not surprised), so I ended up performing a > for loop based on x1 and subsetting the matrix based on x1. However I > have a hunch that their should be a less expensive way of doing this > processing. Any ideas or tips to optimize this processing logic would > be greatly appreciated. > [[alternative HTML version deleted]] ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help