再次感谢有用的评论。我试图实现你的建议(drop = T和droplevels),但仍然有原始问题。到目前为止这是问题所在: 当我试图制作一个'HAFREN1'的箱线图时,情节会出现但仍然包含来自'NPS'的所有因素 - 我怎么能阻止它们作为情节的一部分出现?再次感谢。
NPS <- read.csv(choose.files(), header = T)
attach(NPS)
boxplot(K.CM.DAY~site.id, las = 3,
par(mar = c(13,4,2,2)))
NPSsplit1 <- split(NPS, NPS$site.id, drop=T)
HAFREN1 <- rbind(NPSsplit1$`HAF GRAZED NAT GRASS`, NPSsplit1$`HAF MATURE
TREES`, NPSsplit1$`HAF YNG TREES`)
detach(NPS)
attach(HAFREN1)
droplevels(HAFREN1, exclude = c("NEWBO' GRAZED", "NEWBO' UNGRAZED",
"NEWBO' OLD DUNES", "S.L GRZD IMPRVD GRASS",
"S.L NAT GRZD GRASS", "S.L pheasant woods", "S.L GRZD IMPRVD
GRASS","S.L GRAZED TREES", "S.F TREES", "S.F ARABLE", "S.F FLORISTIC
GRASS","S.F GRAZED GRASS" ))
boxplot(K.CM.DAY~site.id, data = HAFREN1)
以下是“NPS”
的完整数据 site.id K.CM.SEC K.CM.DAY
1 NEWBO' GRAZED 1.916489e-03 165.5846836
2 NEWBO' GRAZED 5.685340e-04 49.1213616
3 NEWBO' GRAZED 5.185110e-04 44.7993185
4 NEWBO' GRAZED 1.434850e-04 12.3970979
5 NEWBO' UNGRAZED 7.947200e-04 68.6638281
6 NEWBO' UNGRAZED 1.497260e-04 12.9363503
7 NEWBO' UNGRAZED 4.506080e-04 38.9325075
8 NEWBO' OLD DUNES 9.605890e-05 8.2994922
9 NEWBO' OLD DUNES 3.004300e-04 25.9571866
10 NEWBO' OLD DUNES 3.163820e-04 27.3353784
11 NEWBO' OLD DUNES 2.599810e-04 22.4623165
12 PUM GRAZED GRASS 1.934380e-04 16.7130833
13 PUM GRAZED GRASS 2.352360e-05 2.0324400
14 PUM GRAZED GRASS 9.307130e-05 8.0413621
15 PUM GRAZED GRASS 6.701040e-05 5.7896950
16 PUM GRAZED GRASS 1.635820e-04 14.1334936
17 PUM GRAZED TREES 9.899350e-05 8.5530351
18 PUM GRAZED TREES 1.838510e-04 15.8847159
19 HAF GRAZED NAT GRASS 2.514190e-04 21.7226206
20 HAF GRAZED NAT GRASS 4.024630e-04 34.7728153
21 HAF GRAZED NAT GRASS 2.872780e-05 2.4820856
22 HAF GRAZED NAT GRASS 1.362320e-04 11.7704208
23 HAF GRAZED NAT GRASS 3.141210e-05 2.7140027
24 HAF GRAZED NAT GRASS 4.019900e-04 34.7319472
25 HAF GRAZED NAT GRASS 1.172680e-04 10.1319880
26 HAF MATURE TREES 1.119040e-04 9.6684926
27 HAF MATURE TREES 5.910299e-03 510.6498559
28 HAF MATURE TREES 1.877630e-04 16.2227583
29 HAF MATURE TREES 1.108890e-04 9.5807732
30 HAF MATURE TREES 2.993970e-04 25.8678921
31 HAF MATURE TREES 2.734273e-03 236.2411852
32 HAF MATURE TREES 1.493940e-03 129.0764039
33 HAF YNG TREES 3.002123e-03 259.3833846
34 HAF YNG TREES 3.825811e-03 330.5500423
35 HAF YNG TREES 4.210470e-04 36.3784414
36 HAF YNG TREES 4.857110e-05 4.1965421
37 HAF YNG TREES 4.273473e-03 369.2280804
38 HAF YNG TREES 6.639711e-03 573.6710181
39 HAF YNG TREES 3.178988e-03 274.6645952
40 S.L GRZD IMPRVD GRASS 1 3.755320e-05 3.2446005
41 S.L GRZD IMPRVD GRASS 1 4.076420e-04 35.2202696
42 S.L GRZD IMPRVD GRASS 1 1.699937e-03 146.8745987
43 S.L GRZD IMPRVD GRASS 1 6.935580e-04 59.9234425
44 S.L GRZD IMPRVD GRASS 1 4.140920e-04 35.7775064
45 S.L GRZD IMPRVD GRASS 1 1.751798e-03 151.3553348
46 S.L GRZD IMPRVD GRASS 1 7.242830e-05 6.2578080
47 S.L GRZD IMPRVD GRASS 1 4.187560e-05 3.6180550
48 S.L GRZD IMPRVD GRASS 1 2.898640e-05 2.5044226
49 S.L NAT GRZD GRASS 9.190450e-05 7.9405490
50 S.L NAT GRZD GRASS 5.594110e-05 4.8333091
51 S.L pheasant woods 1.262860e-05 1.0911135
52 S.L pheasant woods 4.442918e-03 383.8681083
53 S.L pheasant woods 1.283240e-04 11.0871588
54 S.L pheasant woods 7.984330e-04 68.9846040
55 S.L pheasant woods 8.069750e-05 6.9722628
56 S.L pheasant woods 4.474640e-06 0.3866091
57 S.L pheasant woods 2.641400e-04 22.8216663
58 S.L GRZD IMPRVD GRASS 2 1.141300e-04 9.8608365
59 S.L GRZD IMPRVD GRASS 2 1.161330e-04 10.0339052
60 S.L GRZD IMPRVD GRASS 2 2.696315e-03 232.9616580
61 S.L GRAZED TREES 9.302370e-05 8.0372445
62 S.L GRAZED TREES 2.917180e-05 2.5204423
63 S.L GRAZED TREES 9.377750e-05 8.1023777
64 S.F TREES 1.028086e-03 88.8266135
65 S.F ARABLE 1.720700e-05 1.4867253
66 S.F ARABLE 1.654900e-05 1.4298659
67 S.F ARABLE 2.200800e-05 1.9015200
68 S.F FLORISTIC GRASS 1.555882e-03 134.4281958
69 S.F FLORISTIC GRASS 2.232400e-05 1.9287530
70 S.F FLORISTIC GRASS 2.808200e-05 2.4263203
71 S.F GRAZED GRASS 1.489970e-04 12.8733386
72 S.F GRAZED GRASS 1.001910e-04 8.6564852
答案 0 :(得分:0)
非常感谢所有人 - 终于找到了我需要做的事情,即使用论证&#39; drop = T&#39;在&#39; boxplot&#39;命令,改变上面的最后一行
boxplot(K.CM.DAY~site.id, data = HAFREN1)
到
boxplot(K.CM.DAY~site.id, data = HAFREN1, drop = T)