[R] Sandard deviation calculation
(Ted Harding)
Ted.Harding at manchester.ac.uk
Mon Oct 26 15:28:48 CET 2009
On 26-Oct-09 09:44:55, ms.com wrote:
>
> 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'])[1] 3.283605
>> sd(Ht_cm[from_treeline=='above'])[1] 16.83289
>> sd(Ht_cm[type=='SD'][from_treeline=='above'])[1] NA
>
> the problem is that, i could not understand why the third command could
> not give any result.
> please help me out
> thanking you
> Regard
> MS
> Nepal
This suggests that either you have only one observation in the
third case, or there is an NA amongst them.
What are the values of
length((Ht_cm[type=='SD'][from_treeline=='above'])[1])
sum(is.na((Ht_cm[type=='SD'][from_treeline=='above'])[1]))
sum((type=='SD')&(from_treeline=='above'))
sum(type=='SD')
sum(from_treeline=='above')
The answers to these may provide adequate clues to diagnose
the reason.
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Oct-09 Time: 14:28:38
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list