[R] mean

Roy Mendelssohn - NOAA Federal roy.mendelssohn at noaa.gov
Fri Aug 30 17:59:19 CEST 2013


Use is.numeric(list)  on the list to see if it is a list of numbers or if it is list of characters.  If it is a list of characters  (which could be the case if you read it in using read.csv or the like) and it makes sense to convert to numeric, then do something like:

list<-as.numeric(list)

-Roy
On Aug 30, 2013, at 5:18 AM, agnes69 <festre at gredeg.cnrs.fr> wrote:

> When I try to apply mean to a list, I get the answer :
> 
> argument is not numeric or logical: returning NA
> 
> Could you help me?
> 
> (I am a very beginner)
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/mean-tp4674999.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: Roy.Mendelssohn at noaa.gov (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.



More information about the R-help mailing list