Loop overwriting
问题 I have R version 3.1.0 and am using Windows 7. I am trying to write a loop for a dataset with 474 rows. For every unique ID value I can have several values for the tow column. The strata and number columns are the same for all unique values of ID. I would like to calculate the variance with this equation: (sum((sall$tow-sall$strata)^2))/unique(sall$number)* (unique(sall$number)-1) for all unique ID values. From what I have been reading online it looks like my loop is overwriting itself. To