Re: [R] Error: arguments imply differing number of rows

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Wed, 12 Mar 2008 13:24:23 -0400 (EDT)


Try str() on both objects and see what you get. It does not look like you have two vectors of length=1762.

See this for example



aa <- c("A", "B", "D", "D","B", "B","D", "A", "C", "C", "A","D")
bb <- rnorm(length(aa))
cc <- matrix(rnorm(length(aa)),nrow=2)

length(bb)
length(cc)

boxplot(bb~aa)
boxplot(cc~aa)


> I am simply trying to put 4 boxplots on the same
> plot, but I keep
> getting the "arguments imply differing number of
> rows" error. Here, I
> have two variables: a factor x of length 1762 (with
> 4 levels) and a
> numeric variable y of length 1762. How is it that my
> arguments imply
> differing numbers of rows?
>
> > length(x)
> [1] 1762
> > length(y)
> [1] 1762
> > is.factor(x)
> [1] TRUE
> > is.numeric(y)
> [1] TRUE
> > plot(x,y)
> Error in data.frame(group, x) :
> arguments imply differing number of rows: 1762,
> 2165
> > boxplot(y~x)
> Error in data.frame(group, x) :
> arguments imply differing number of rows: 1762,
> 2165
>
> ______________________________________________
> 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.
>

[[elided trailing spam]]



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. Received on Wed 12 Mar 2008 - 17:29:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Mar 2008 - 17:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive