Re: [R] Help on loops

2010-12-08 Thread Anup Nandialath
Thanks Jim! --- On Tue, 12/7/10, jim holtman wrote: From: jim holtman Subject: Re: [R] Help on loops To: "Anup Nandialath" Cc: r-help@r-project.org Date: Tuesday, December 7, 2010, 7:47 PM use split and lapply to make it easier.  Substitute in your own calculations since this

Re: [R] Help on loops

2010-12-07 Thread jim holtman
use split and lapply to make it easier. Substitute in your own calculations since this is just an example: > x id t X1 X2 1 1 1 4 3 2 1 2 9 2 3 1 3 7 3 4 1 4 6 6 5 2 1 6 4 6 2 2 5 3 7 2 3 1 1 8 3 1 9 6 9 3 2 5 5 > # first split the data by 'id' > x.s <- split(x, x$id)