[R] Error occurred during mean calculation of a column of a data frame, which is apparently contents numeric data

Berend Hasselman bhh at xs4all.nl
Wed Feb 29 12:06:49 CET 2012


On 29-02-2012, at 11:49, Aniruddha Mukherjee wrote:

> 
> Hello Berend. 
> 
> Many thanks for your prompt reply and that helped me a lot. One more thing, if you please explain, I shall be highly obliged. 
> Why in my case (i.e. when stringsAsFactors was TRUE by default), 
> > as.numeric(matr1$Pulse_rate) 
> displays the following 
>  [1]  4  5  7  5  9  8  6 10  3  2  5  1 10 10 
> ? 

?factor

and play a little bit

as.factor(c("A","8.9"))
as.numeric(as.factor(c("A","8.9")))
str(as.factor(c("A","8.9")))

and read the R Intro manual (chapter 4).

Berend



More information about the R-help mailing list