Re: [R] Averaging without NAs

2017-03-02 Thread Berend Hasselman

> On 2 Mar 2017, at 11:53, ch.elahe via R-help  wrote:
> 
> Hi all,
> 
> The question seems easy but I could not find an answer for it. I have the 
> following column in my data frame and I want to take average of the column 
> excluding the number of NAs. 
> 
> $X2016.Q1 : int 47 53 75 97 NA NA 23 NA 43 NA 
> 
> Does anyone know how to do that?

Have you tried looking in the help for mean?

?mean

Berend Hasselman

> Thanks for any help 
> Elahe
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Averaging without NAs

2017-03-02 Thread Ulrik Stervbo
Hi Elahe,

?mean

in particular the na.rm argument.

HTH
Ulrik

On Thu, 2 Mar 2017 at 11:55 ch.elahe via R-help 
wrote:

> Hi all,
>
> The question seems easy but I could not find an answer for it. I have the
> following column in my data frame and I want to take average of the column
> excluding the number of NAs.
>
> $X2016.Q1 : int 47 53 75 97 NA NA 23 NA 43 NA 
>
> Does anyone know how to do that?
> Thanks for any help
> Elahe
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Averaging without NAs

2017-03-02 Thread ch.elahe via R-help
Hi all,

The question seems easy but I could not find an answer for it. I have the 
following column in my data frame and I want to take average of the column 
excluding the number of NAs. 

$X2016.Q1 : int 47 53 75 97 NA NA 23 NA 43 NA 

Does anyone know how to do that?
Thanks for any help 
Elahe

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.