[R] How to do ANOVA with fractional values and overcome the error: Error in `storage.mode<-`(`*tmp*`, value = "double") : invalid to change the storage mode of a factor

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Sep 6 09:43:07 CEST 2007


Your data file has commas as the decimal point. Use read.csv2 for such 
files.

What happened was that PercentError was read as a factor, and you can't do 
ANOVA on factors.  The warning

> In addition: Warning message:
> using type="numeric" with a factor response will be ignored in:
> model.response(mf, "numeric")

told you and us this quite explicitly.  If you get an error, also look at 
the warnings which may well (as here) tell you what precipitated the 
error.

On Thu, 6 Sep 2007, Emre Sevinc wrote:

> I have exported a CSV file from my EXCEL worksheet and its last column contained decimal values:
>
> Subject;Group;Side;Difference;PercentError
> M3;1;1;;
> M5;1;1;375;18,75
> M8;1;1;250;14,58
> M10;1;1;500;12,50
> M12;1;1;375;25,00
> .
> .
> .
>
>
> When I tried to do ANOVA test on it, R complained by givin error:
>
>> Anova3LongAuditoryFemaleError.data <- read.csv("C:\\Documents\ and\ Settings\\Administrator\\My Documents\\CogSci\\tez\\Anova3LongAuditoryFemaleError.csv", header = TRUE, sep = ";")
>
>> Anova3LongAuditoryFemaleError.aov = aov(PercentError ~ (Group * Side), data = Anova3LongAuditoryFemaleError.data)
>
> Error in `storage.mode<-`(`*tmp*`, value = "double") :
>        invalid to change the storage mode of a factor
> In addition: Warning message:
> using type="numeric" with a factor response will be ignored in:
> model.response(mf, "numeric")
>
> What must I do in order to make the ANOVA test on these fractional data?
>
> Regards.
>
> --
> Emre Sevinc
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list