[R] Sandard deviation calculation
murdoch at stats.uwo.ca
Tue Oct 27 20:24:28 CET 2009
On 27/10/2009 2:58 PM, marcos carvajalino wrote:
> Dear ms.
> The most possible reason for this:
>> Dear all
>> I am trying to learn R
>> I was trying to calculate standard deviation
>> here are the commands and outputs in R
>>> sd(Ht_cm[type=='SD']) 3.283605> sd(Ht_cm[from_treeline=='above']) 16.83289> >sd(Ht_cm[type=='SD'][from_treeline=='above']) NA>
>> the problem is that, i could not understand why the third command could not give any >result.
>> please help me out
>> thanking you
> is that you're trying to calculate sd over a vector where a NA (Not
> available) value is contained, that is, you have an empty cell, a
> different type of data or no data satisfies your condition, try:
> That should do it...
That's legal syntax, but it is very unlikely to be correct. Hadley gave
good advice (modulo his typo).
More information about the R-help