[R] wrong data interpretation in R

Don McKenzie dmck at u.washington.edu
Mon Nov 26 18:03:09 CET 2012


Robert -- it may be that some of your factor variables cannot be  
coerced to numeric because they have non-numeric elements.
This is why we ask for a reproducible example when posting.  I  
suspect just a few lines from the data frame would tell the story.

On 26-Nov-12, at 7:59 AM, EcoFranc wrote:

> Hi,
>
> maybe somebody would be kind enough to help a bloody and  
> unprofessional
> beginner like me (and I hope I did not overlook the answer to my  
> question on
> the website). I've imported a csv data frame into R, but I can't run a
> regression because R interprets 4 out of 5 variables as factors  
> (rather than
> numeric vectors). I tried the as.numeric() command, but R says it  
> is invalid
> to change the storage mode of a factor. Is there any way to change  
> the mode
> of a factor into numeric.
>
> I am very grateful for help. Thank you very much, Robert.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/wrong- 
> data-interpretation-in-R-tp4650849.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.





Don McKenzie, Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service
phone: 206-732-7824

Affiliate Professor
School of Environmental and Forest Sciences
University of Washington




More information about the R-help mailing list