Skip to content
Prev 309179 / 398506 Next

why sd() can be applied to character vector?

On 27/10/2012 10:16, Jinsong Zhao wrote:
Well, it is there:

        x: a numeric vector or an R object which is coercible to one by
           ?as.vector?.

 > as.vector(x, 'numeric')
  [1]  1  2  3  4  5  6  7  8  9 10

And it is different from mean() because that is generic and allows many 
other forms of input, whereas for sd() one knows what to coerce to.