> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Hongwei Dong
> Sent: Monday, August 03, 2009 2:26 PM
> To: r-help at R-Project.org
> Subject: [R] What does this error message mean?
>
> Hi, I used R to run a linear regression and keep getting the
> following error
> message. I do not understand it very well. Anyone can help
> out? Thanks.
>
> Error in storage.mode(y) <- "double" :
> invalid to change the storage mode of a factor
> In addition: Warning message:
> In model.response(mf, "numeric") :
> using type="numeric" with a factor response will be ignored
I see the words 'response' , 'factor', and 'numeric' in
that message
and think that it has to do with lm() only being defined for numeric
response variables, not factor (categorical) responses. E.g.,
> d<-data.frame(fac=letters[c(1:3,1:3)], x=1:6)
> lm(data=d, fac~x)
Error in storage.mode(y) <- "double" :
invalid to change the storage mode of a factor
In addition: Warning message:
In model.response(mf, "numeric") :
using type="numeric" with a factor response will be ignored
If you had showed us your dataset and your command we
could say for sure if this was the problem. The error message
alone is rarely as informative as this one.
Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>