[R] Error Message During ANOVA

2019-03-21 Thread Sara Ciancitto via R-help
I know this is several years later but...

I ran into the same issue and was able to solve it by verifying the spacing 
between variables within original text file. For example, Item1, Item2, and 
Item3 had a single space between them while the numbers in each item had 5 
spaces between them, resulting in a mismatch between r and tm. 

Hope this helps somebody. 

Chris
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Error Message During ANOVA

2013-03-21 Thread Rodinsky, Dr Harold R.
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')


Thanks in advance

Harold Rodinsky PhD
Associate Professor
Department of Psychology
University of the Incarnate Word
4301 Broadway
San Antonio, TX 78209




This email and any files transmitted with it may be conf...{{dropped:13}}

__
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.


Re: [R] Error Message During ANOVA

2013-03-21 Thread Nordlund, Dan (DSHS/RDA)
 -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.


Re: [R] Error Message During ANOVA

2013-02-13 Thread Pascal Oettli

Hello,

The first error message says:

 Error in model.frame.default(formula = r ~ tm, drop.unused.levels = 
TRUE) : variable lengths differ (found for 'tm')


Please compare the size of 'r' and 'tm'.

Regards,
Pascal

Le 14/02/2013 07:14, Craig O'Connell a écrit :

Dear R-Help,

I'm using an ANOVA to determine if there is any variation that exists
between my four different shark-types and their entrance behavior towards
an apparatus.

To do this, my coding was:

df1=read.table(lemonentrance.txt, header=TRUE); df1

c(t(as.matrix(df1)))

r = c(t(as.matrix(df1))) # response data

r

f=c(Con,Bro,OEy,Bli)

k=4

n=6

tm=gl(k,1,n*k,factor(f))

tm

av=aov(r~tm)

Error in model.frame.default(formula = r ~ tm, drop.unused.levels = TRUE) :
   variable lengths differ (found for 'tm')

summary(av)

Error in summary(av) : object 'av' not found

As you can see, I receive two error message, with teh second being a cause
of the first.  Does anybody have any idea how I can fix this, or at least
would you happen to know what the error is referring to?

Thanks and a response would be greatly appreciated.

Kind Regards,

Craig





__
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.