> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Rodinsky, Dr Harold R.
> Sent: Thursday, March 21, 2013 11:32 AM
> To: 'r-help@r-project.org'
> Subject: Re: [R] Error Message During ANOVA
> 
> I am teaching myself R for use in Psych research. I don't understand
> the error message I am getting or how to fix it. Any suggestions will
> be greatly appreciated
> 
> 
> df1=read.table("fastfood.txt", header=TRUE); df1
> >
> > c(t(as.matrix(df1)))
> >
> > r = c(t(as.matrix(df1))) # response data
> >
> > r
> >
> f=c("item1","item2", "item3")
> > k=3
> > n=6
> > tm =gl(k,1, n*k, factor(f))
> > tm
> [1] item1 item2 item3 item1 item2 item3 item1 item2 item3 item1 item2
> item3
> [13] item1 item2 item3 item1 item2 item3
> Levels: item1 item2 item3
> 
> > av=aov(r~tm)
> >
> > Error in model.frame.default(formula = r ~ tm, drop.unused.levels =
> TRUE) :
> >    variable lengths differ (found for 'tm')
> 
> 

It looks like you are working way too hard to run your anova.  First, the 
posting guide (see link at bottom or emails) asks you to provide a reproducible 
example.  The error message states that r and tm have different lengths.  At a 
minimum, we need to see what the df1 looks like.  Show us the output of 

str(df1)

so we can understand what your commands are doing.  Without more information 
there is not much we can do to help.


Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204


______________________________________________
R-help@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.

Reply via email to