[R] ANOVA Data Error

David Winsemius dwinsemius at comcast.net
Tue Apr 17 19:43:28 CEST 2012


On Apr 17, 2012, at 1:03 PM, MatthewJudd wrote:

> Hello I am having some trouble performing a simple ANOVA in R
>
> I am working with 2001 census tract information regarding religion.   
> I am
> quite a rookie at this whole R experiance, but I would like to  
> improve my
> skills.
>
> *I read in my data and subset it accordingly to select only the  
> columns I
> desired. *
>
> newottawa 
> =ottawa_census[,c(97,121,124,125,126,127,128,129,130,131,132,133)]
> newottawa
>
> *This is the formula  used to try and perform my ANOVA*
>
> anovaottawa=aov(newottawa$RomanCatholic~newottawa$UnitedChurch)
> summary(anovaottawa)
>
> ****The (-) in the formula is actually a tilde in my R code (but it  
> wont
> show up properly in this email)
>
> *My Error Message:*
>
> Error in lm.fit(x, y, offset = offset, singular.ok =  
> singular.ok, ...) :
>  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 fear that my data is in the wrong format or something of that  
> nature and
> thus R will not allow me to perform analysis on it.

It would seem passing strange to have a variable named RomanCatholic  
that was a continuous variable. My guess is that you are not using the  
function properly. How much experience do you have with regression  
functions in R ... and a corollary question:  is this homework?

-- 
David.
>



David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list