Displaying 1 result from an estimated 1 matches for "tp19974078p19991682".
2008 Oct 14
6
Doing a Task Without Using a For Loop
Assume that I have the dataframe "data1", which is listed at the end of this
message. I want count the number of lines that each person has for each
year. For example, the person with ID=213 has 15 entries (NinYear) for 1953.
The following bit of code calculates NinYear:
for (i in 1:length(data1$ID)) {
data1$NinYear[i] <- length(data1[data1$Year==data1$Year[i] &