Re: [R] how to rbind matrices from different loops

2012-02-16 Thread jim holtman
If you want a row for each unique item: > example <- data.frame(id=rep( + ( abs(round(rnorm(50,mean=500,sd=250),digits=0))) + ,3), group=rep(1:15,10)) > example <-example[with(example,order(id,group)),] > > uniqueIDs <- do.call(rbind + , lapply(split(example, example$group), function(.grp){ +

Re: [R] how to rbind matrices from different loops

2012-02-16 Thread jim holtman
Is this close to what you want: > example <- data.frame(id=rep( + ( abs(round(rnorm(50,mean=500,sd=250),digits=0))) + ,3), group=rep(1:15,10)) > example <-example[with(example,order(id,group)),] > > uniqueIDs <- do.call(rbind + , lapply(split(example, example$group), function(.grp){ +

[R] how to rbind matrices from different loops

2012-02-16 Thread Matt Spitzer
Dear R experts, I am having difficulty using loops productively and would like to please ask for advice. I have a dataframe of ids and groups. I would like to break down the dataframe into groups, find the unique sets of ids, then reassemble. My thought was to use a loop, but I have been unable