[R] RES: "Invalid object" error in boxplot
Leandro Marino
leandro at cesgranrio.org.br
Tue Jul 1 19:41:58 CEST 2008
HI Miriam,
the problem is that you have the Date and some other factors in your
database.
try to use the
lapply(your_base,class)
and see what appears. If you have any kind of factor or date you cannot use
boxplot.
If you verify that only V1, V2 and V3 are numeric you can do the box plot
with this sintax:
boxplot(your_base[,c("V1","V2","V3"])
or
boxplot(your_base[,c(5:7)]
Leandro Marino
-----Mensagem original-----
De: r-help-bounces em r-project.org [mailto:r-help-bounces em r-project.org]Em
nome de mm745 em st-andrews.ac.uk
Enviada em: terca-feira, 1 de julho de 2008 12:22
Para: r-help em r-project.org
Assunto: [R] "Invalid object" error in boxplot
Hi,
I'm trying to make a boxplot with the data at the end of the message, and
when I
try to execute the command
>boxplot(Diatoms) (or for any other field instead of "Diatoms")
I get the following error message:
Error in oldClass(stats) <- cl : adding class "factor" to an invalid object
Any advice would be much appreciated.
Thanks a lot,
Miriam
Date Depth Diatoms Bacteria V1 V2 V3
1 15/02/2000 0 17 700,000 14,067,895 380,000 69,000
2 15/02/2000 2 17 316,680 9,311,160 250,000 26,000
3 15/02/2000 10 20 313,010 8,422,355 460,000 30,000
4 15/02/2000 20 21 374,535 9,259,900 280,000 33,000
5 22/02/2000 0 21 370,000 16,952,360 320,000 72,000
6 22/02/2000 2 21 462,480 10,526,390 360,000 64,000
7 22/02/2000 10 39 374,860 8,378,655 290,000 49,000
8 22/02/2000 20 140 381,900 9,468,550 390,000 73,000
9 29/02/2000 0 240 200,000 5,783,980 440,000 61,000
10 29/02/2000 2 240 224,125 8,077,105 600,000 89,000
11 29/02/2000 10 110 190,810 8,154,005 600,000 61,000
12 29/02/2000 20 460 177,050 8,333,120 600,000 69,000
13 08/03/2000 0 1,800 270,000 5,277,265 200,000 34,000
14 08/03/2000 2 1,800 403,380 9,237,105 490,000 80,000
15 08/03/2000 10 1,400 372,530 10,624,735 480,000 57,000
16 08/03/2000 20 3,100 261,215 6,228,160 340,000 37,000
17 14/03/2000 0 4,900 750,000 16,258,720 440,000 80,000
18 14/03/2000 2 4,900 633,895 10,952,305 380,000 54,000
19 14/03/2000 10 4,100 583,367 10,383,383 310,000 53,000
20 14/03/2000 20 8,200 653,945 10,148,210 380,000 48,000
21 21/03/2000 0 850 570,000 11,000,000 180,000 170,000
22 21/03/2000 2 850 520,000 27,000,000 130,000 190,000
23 21/03/2000 10 1,800 540,000 21,000,000 250,000 140,000
24 21/03/2000 20 1,800 470,000 10,000,000 110,000 70,000
25 27/03/2000 0 1,300 640,000 13,000,000 170,000 90,000
26 27/03/2000 2 1,300 770,000 17,000,000 230,000 120,000
27 27/03/2000 10 520 720,000 15,000,000 120,000 170,000
28 27/03/2000 20 130 620,000 12,000,000 98,000 74,000
29 04/04/2000 0 2,003 940,000 29,582,000 190,000 46,000
30 04/04/2000 2 2,003 952,400 27,186,525 210,000 67,000
31 04/04/2000 10 1,671 503,300 11,140,225 85,000 24,000
32 04/04/2000 20 863 682,550 14,605,825 140,000 32,000
33 07/04/2000 0 1,653 840,000 15,862,125 370,000 95,000
34 07/04/2000 2 1,653 819,350 13,099,600 280,000 67,000
35 07/04/2000 10 1,520 769,825 13,395,825 240,000 57,000
36 07/04/2000 20 422 784,700 10,910,700 170,000 28,000
37 12/04/2000 0 7,671 640,000 9,851,750 470,000 100,000
38 12/04/2000 2 7,671 600,625 9,339,400 490,000 170,000
39 12/04/2000 10 5,865 585,650 8,439,300 450,000 180,000
40 12/04/2000 20 1,276 595,225 7,297,150 360,000 92,000
41 14/04/2000 0 10,479 730,000 12,406,650 540,000 140,000
42 14/04/2000 2 10,479 700,000 10,406,650 490,000 110,000
43 14/04/2000 10 6,576 682,500 9,869,050 470,000 100,000
44 14/04/2000 20 3,307 739,075 8,875,250 420,000 180,000
45 16/04/2000 0 1,636 890,000 9,653,050 290,000 120,000
46 16/04/2000 2 1,636 885,725 9,934,300 300,000 97,000
47 16/04/2000 10 2,986 973,750 10,270,975 310,000 190,000
48 16/04/2000 20 1,222 629,250 6,792,500 210,000 90,000
49 19/04/2000 0 656 730,000 12,751,350 510,000 150,000
50 19/04/2000 2 656 831,575 13,673,700 400,000 120,000
51 19/04/2000 10 480 723,925 11,230,150 420,000 100,000
52 19/04/2000 20 872 671,975 9,858,900 330,000 97,000
53 27/04/2000 0 180 1,000,000 15,346,525 370,000 85,000
54 27/04/2000 2 180 926,800 22,825,400 670,000 93,000
55 27/04/2000 10 7 880,925 15,121,675 490,000 86,000
56 27/04/2000 20 64 723,100 10,638,400 230,000 21,000
------------------------------------------------------------------
University of St Andrews Webmail: https://webmail.st-andrews.ac.uk
______________________________________________
R-help em 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.
More information about the R-help
mailing list