sigalit mangut-leiba wrote:
> I'm sorry for the unfocused questions, i'm new here...
> the output should be:
> class    aps_mean
> 1              na
> 2             11.5
> 3               8
>
> the mean aps of every class, when every id count *once*,  for example: class
> 2, mean= (11+12)/2=11.5
> hope it's clearer.
>   
Much... Get the first record for each individual from (e.g.)

icul.redux <- subset(icul, !duplicated(id))

then use tapply as before using variables from icul.redux. Or in one go

with(
  subset(icul, !duplicated(id)),
  tapply(aps, class, mean, na.rm=TRUE)
)


-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to