Skip to content
Prev 309178 / 398506 Next

why sd() can be applied to character vector?

On Sat, Oct 27, 2012 at 10:16 AM, Jinsong Zhao <jszhao at yeah.net> wrote:
Practically, I see

$R_HOME/src/library/stats/src/cov.c:633 has

x = PROTECT(coerceVector(x, REALSXP));

which seems to be responsible for the behavior you note (eventually
calling $R_HOME/src/main/util.c:1463), but mean.default catches the
character case early and returns NA_real_.

None of that explains the reasoning however and it does seem a little anomalous

Cheers,
Michael