Re: [R] Executing for loop by grouping variable within dataframe

2011-07-28 Thread ssobek
Dear Dennis, Thank you very much for your quick response! Your code does indeed solve my problem. I figured I would have to define a function somehow to use anything like ddply or similar, but couldn't wrap my head around how to set it up properly. I only started using R for anything more

[R] Executing for loop by grouping variable within dataframe

2011-07-27 Thread ssobek
Dear list, I have a large dataset which is structured as follows: locality=c(USC00020958, USC00020958, USC00020958, USC00020958, USC00020958, USC00021001,USC00021001, USC00021001, USC00021001, USC00021001, USC00021001) temp.a=c(-1.2, -1.2, -1.2, -1.2, -1.1, -2.2, -2.4, -2.6,-2.7, -2.8, -3.0)

Re: [R] Executing for loop by grouping variable within dataframe

2011-07-27 Thread Dennis Murphy
Hi: I don't get exactly the same results as you did in the second group (how does temp.t[1] = -2.0 instead of -2.2?) but try this: locality=c(USC00020958, USC00020958, USC00020958, USC00020958, USC00020958, USC00021001,USC00021001, USC00021001, USC00021001, USC00021001, USC00021001)