Skip to content
Prev 162594 / 398500 Next

Calculating SD according to groups of rows

hadley wickham <h.wickham <at> gmail.com> writes:
Not really, it looks like the breakdown is somehow done:
SUBJECT_ID SUBJECT_ID        HR
         a         NA 1.0488930
         b         NA 0.9110685
         c         NA 1.0776996
         d         NA 1.1724009
         e         NA 0.9455105
Warning messages:
1: In var(as.vector(x), na.rm = na.rm) : NAs introduced by coercion
..more warnings
SUBJECT_ID        HR
1         NA 1.0488930
2         NA 0.9110685
3         NA 1.0776996
4         NA 1.1724009
5         NA 0.9455105
Warning messages:
1: In var(as.vector(x), na.rm = na.rm) : NAs introduced by coercion

That's what I meant by "almost correct". Your suggestion works, but wouldn't is
be a good default to make numcolwise(sd) the default with this close miss?

Dieter