Hello there,

I'm still struggling with the *apply commands. I have 5 people with id's
from 10 to 14. I have varying amounts (nrep) of repeated outcome (value)
measured on them.

nrep <- 1:5
id    <- rep(c("p1", "p2", "p3", "p4", "p5"), nrep)
value <- rnorm(length(id))

I want to create a new vector that contains the sum of the values per
person.

subject.value[1] <- value[1]    # 1 measurement
subject.value[2] <- sum(value[2:3]) # the next 2 measurements
...
subject.value[5] <- sum(value[11:15])  # the next 5 measurements


I'd imagine it'll be some sort of *apply(value, nrep, sum) but I can't seem
to land on the right format.

Can someone give me a heads up as to what the correct syntax and function
is?

Danke,

Robin Jeffries
MS, DrPH Candidate
Department of Biostatistics
UCLA
530-624-0428

	[[alternative HTML version deleted]]

