[R] How to fix error: 'x' and 'y' lengths differ
klsk89
karenklsk89 at yahoo.com
Wed Sep 22 05:27:23 CEST 2010
Hi, im a student so still very new to R. Hope someone could help me out here
=)
They are 3 slug control products, bustaslug, product X and Y. Im ask to
explore the data by plot() and tapply(). But when i try to plot or use the
tapply command, it tells me that the x and y lengths differ. so im thinking
its because the data is unbalanced? Is there a simple command that i could
use to fix this? Thanks for the help.
Heres what i did.
> attach(slugs)
> slugs
product slugs
1 bustaslug 5
2 bustaslug 2
3 bustaslug 3
4 bustaslug 0
5 bustaslug 4
6 bustaslug 4
7 bustaslug 1
8 bustaslug 5
9 bustaslug 6
10 bustaslug 4
11 productX 0
12 productX 3
13 productX 4
14 productX 1
15 productX 2
16 productX 2
17 productX 4
18 productX 0
19 productX 3
20 productX 1
21 productY 7
22 productY 9
23 productY 11
24 productY 5
25 productY 13
26 productY 7
27 productY 8
28 productY 12
29 productY 10
30 productY 14
> plot(as.factor(product),slugs)
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
> tapply(slugs,product,mean)
Error in tapply(slugs, product, mean) : arguments must have same length
--
View this message in context: http://r.789695.n4.nabble.com/How-to-fix-error-x-and-y-lengths-differ-tp2549694p2549694.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list