在lattice包中对水平条形图上的y轴重新排序

发布于 2024-12-06 07:19:34 字数 15274 浏览 0 评论 0原文

我对 R 比较陌生,我想知道是否有人可以帮助我制作我正在尝试使用lattice包创建的条形图。我已经成功创建了下面的图(无法发布,因为我是新用户)。每个面板代表一个单独物种的丰度,而条形代表每个物种幼虫阶段在特定深度的堆叠丰度。问题是我想以更直观的方式呈现深度,每个面板的顶部为 0 m,底部为 90 m - 这意味着沿着条形图“翻转”轴。我使用以下代码创建了此图:

    # create a new column for Species and Depth as factors
    stn8_9$Depth_mF<-as.factor(stn8_9$Depth_m)
    stn8_9$SpeciesF<-as.factor(stn8_9$Species)

    # log root transform data
    stn8_9$logAbundance_per_m3<-(stn8_9$Abundance_per_m3)^(1/4) 

    # now create chart
    barchart(Depth_mF~logAbundance_per_m3 | SpeciesF,
    data=stn8_9[stn8_9$SpeciesF!="CYP" & stn8_9$Stn==9,],
    horiz=TRUE, ylab="depth (m)",xlab="Abundance (#/m3)", 
    main="Station 9", origin=0,
    col=c("red","orange","yellow","green","blue","purple"),
    stack=TRUE, groups=stn8_9$Stage,
    key=
    list(title="Stage", cex.title=1,text=list(c("1","2","3","4","5","6")),
    space="right", rectangles=list(size=2,border="white",
    col=c("red","orange","yellow","green","blue","purple"))))

数据集在底部提供(希望其格式正确)

我了解条形图将我的“深度”值转换为因子,并且我尝试使用 reorder() 和 relevel(),并设法使轴标签翻转,但条形仍保留在同一位置(不知道为什么)。我想要顶部的“0 m”栏和底部的“90 m”栏 - 有人可以帮忙吗?

数据集:

 dput(stn8_9)
structure(list(Stn = c(9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L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 90L, 90L, 
90L, 90L, 90L, 90L, 90L, 90L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 
60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 
60L, 60L, 60L, 60L, 60L, 60L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 
40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 
40L, 40L, 40L, 40L, 40L, 40L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 
70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 
70L, 70L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 
40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 
40L, 40L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 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L, 4L, 5L, 6L, 2L, 
3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 
3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 7L, 2L, 
3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 
4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 
4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 
5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L), Abundance_per_m3 = c(0, 
0, 0, 1.267024758, 1.267024758, 0, 0, 0, 0, 0, 5.068099033, 0, 
0, 0, 0, 25.34049517, 0, 0, 3.801074275, 0, 0, 2.534049517, 7.60214855, 
12.67024758, 6.335123791, 0, 0, 0, 0, 3.044963144, 4.059950858, 
2.029975429, 1.014987715, 4.059950858, 5.074938573, 7.104914002, 
3.044963144, 0, 2.029975429, 0, 0, 30.44963144, 0, 0, 4.059950858, 
2.029975429, 0, 11.16486486, 4.059950858, 11.16486486, 2.029975429, 
1.014987715, 0, 0, 0, 0, 0, 9.899386594, 4.949693297, 15.83901855, 
16.82895721, 10.88932525, 3.959754638, 6.929570616, 0, 0, 0, 
24.74846649, 0, 0, 5.939631957, 0, 0.989938659, 1.979877319, 
0.989938659, 1.979877319, 0.989938659, 1.979877319, 0, 0, 0, 
0, 0, 17.89544764, 1.988383071, 9.941915354, 5.965149212, 7.953532283, 
0, 15.90706457, 3.976766141, 1.988383071, 0, 23.86059685, 1.988383071, 
9.941915354, 1.988383071, 0, 0, 0, 9.941915354, 61.63987519, 
51.69795984, 9.941915354, 0, 0, 0, 0, 0, 28.83473086, 48.05788476, 
33.64051933, 14.41736543, 0, 4.805788476, 38.44630781, 4.805788476, 
0, 0, 28.83473086, 19.2231539, 28.83473086, 43.25209628, 33.64051933, 
0, 72.08682714, 163.3968082, 692.0335406, 321.9878279, 86.50419257, 
0, 0, 0, 0, 0, 19.85102993, 9.925514965, 9.925514965, 29.7765449, 
0, 9.925514965, 39.70205986, 19.85102993, 0, 0, 29.7765449, 9.925514965, 
29.7765449, 9.925514965, 19.85102993, 0, 29.7765449, 178.6592694, 
744.4136224, 416.8716286, 49.62757483, 0, 0, 0, 0, 0, 11.25305392, 
3.215158262, 12.86063305, 16.07579131, 8.037895656, 19.29094957, 
6.430316525, 4.822737393, 0, 0, 51.4425322, 1.607579131, 3.215158262, 
1.607579131, 1.607579131, 1.607579131, 1.607579131, 8.037895656, 
6.430316525, 1.607579131, 1.607579131, 0, 0, 0, 0, 0, 30.07822022, 
12.03128809, 15.03911011, 15.03911011, 9.023466065, 13.5351991, 
6.015644043, 0, 1.503911011, 0, 27.07039819, 0, 6.015644043, 
3.007822022, 0, 1.503911011, 9.023466065, 25.56648718, 16.54302112, 
15.03911011, 6.015644043, 0, 0, 0, 4.939940207, 0, 39.51952166, 
14.81982062, 4.939940207, 4.939940207, 4.939940207, 0, 4.939940207, 
4.939940207, 0, 0, 29.63964124, 4.939940207, 4.939940207, 14.81982062, 
0, 0, 29.63964124, 197.5976083, 568.0931238, 261.816831, 54.33934228, 
0, 0, 0, 10.62671701, 0, 21.25343402, 10.62671701, 21.25343402, 
21.25343402, 31.88015104, 0, 0, 0, 0, 0, 10.62671701, 31.88015104, 
0, 31.88015104, 21.25343402, 0, 138.1473212, 244.4144913, 371.9350954, 
212.5343402, 31.88015104, 0, 0, 0, 69.50153499, 19.85758143, 
39.71516285, 29.78637214, 79.4303257, 49.64395357, 79.4303257, 
9.928790713, 39.71516285, 89.35911642, 9.928790713, 0, 29.78637214, 
79.4303257, 19.85758143, 178.7182328, 148.9318607, 99.28790713, 
317.7213028, 615.5850242, 1211.312467, 327.6500935, 69.50153499
), Depth_mF = structure(c(7L, 7L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1L, 1L, 
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 5L, 5L, 
5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 
2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 
6L, 6L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 
3L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L), .Label = c("BB", 
"BC", "CH", "CYP", "SB", "VS"), class = "factor"), logAbundance_per_m3 = c(0, 
0, 0, 1.06095331789381, 1.06095331789381, 0, 0, 0, 0, 0, 1.50041457128417, 
0, 0, 0, 0, 2.24364310060701, 0, 0, 1.39629309072760, 0, 0, 1.26169323444953, 
1.6604816781224, 1.88667144022303, 1.58649525090772, 0, 0, 0, 
0, 1.32097777276068, 1.41948299515758, 1.19363816214162, 1.00372605177853, 
1.41948299515758, 1.50092052805914, 1.63263727001607, 1.32097777276068, 
0, 1.19363816214162, 0, 0, 2.34906757441938, 0, 0, 1.41948299515758, 
1.19363816214162, 0, 1.82794602415898, 1.41948299515758, 1.82794602415898, 
1.19363816214162, 1.00372605177853, 0, 0, 0, 0, 0, 1.77378946506859, 
1.49157320259098, 1.99495023677811, 2.02541630374003, 1.81656207258872, 
1.41064284060004, 1.62246964847031, 0, 0, 0, 2.23042217070931, 
0, 0, 1.56113292684677, 0, 0.99747511829459, 1.18620450786389, 
0.99747511829459, 1.18620450786389, 0.99747511829459, 1.18620450786389, 
0, 0, 0, 0, 0, 2.05676958572452, 1.18747647396250, 1.77569149802404, 
1.562806928309, 1.67934533442396, 0, 1.99708942036914, 1.41215547164577, 
1.18747647396250, 0, 2.21014275343154, 1.18747647396250, 1.77569149802404, 
1.18747647396250, 0, 0, 0, 1.77569149802404, 2.80198262342921, 
2.68144165217603, 1.77569149802404, 0, 0, 0, 0, 0, 2.31728246613553, 
2.63294121550744, 2.40832821053419, 1.94859451890365, 0, 1.48061165227674, 
2.49008206159717, 1.48061165227674, 0, 0, 2.31728246613553, 2.09390107914848, 
2.31728246613553, 2.56449460796253, 2.40832821053419, 0, 2.91382843883587, 
3.57528685520031, 5.12898921614741, 4.23603815839925, 3.04971523426329, 
0, 0, 0, 0, 0, 2.11079356271994, 1.77495874023182, 1.77495874023182, 
2.33597707218005, 0, 1.77495874023182, 2.5101707230885, 2.11079356271994, 
0, 0, 2.33597707218005, 1.77495874023182, 2.33597707218005, 1.77495874023182, 
2.11079356271994, 0, 2.33597707218005, 3.65600169507374, 5.2234035271001, 
4.51856552762811, 2.65418238899045, 0, 0, 0, 0, 0, 1.83154502725781, 
1.33906170112536, 1.89371921865949, 2.00236428275782, 1.68378094745549, 
2.09574482014368, 1.59242170246783, 1.48191537399859, 0, 0, 2.67812340235484, 
1.12601218427985, 1.33906170112536, 1.12601218427985, 1.12601218427985, 
1.12601218427985, 1.12601218427985, 1.68378094745549, 1.59242170246783, 
1.12601218427985, 1.12601218427985, 0, 0, 0, 0, 0, 2.34187135068818, 
1.86242173581786, 1.96927122377906, 1.96927122377906, 1.73317871692943, 
1.91807754972377, 1.56610376120967, 0, 1.10740258963914, 0, 2.28099146904783, 
0, 1.56610376120967, 1.31693103877130, 0, 1.10740258963914, 1.73317871692943, 
2.24862878114404, 2.01675761776174, 1.96927122377906, 1.56610376120967, 
0, 0, 0, 1.49083789392989, 0, 2.50728048152353, 1.96205300969286, 
1.49083789392989, 1.49083789392989, 1.49083789392989, 0, 1.49083789392989, 
1.49083789392989, 0, 0, 2.33328739913925, 1.49083789392989, 1.49083789392989, 
1.96205300969286, 0, 0, 2.33328739913925, 3.74925881222597, 4.88207990404496, 
4.02253091444491, 2.71505476657560, 0, 0, 0, 1.80550950406603, 
0, 2.14712474844036, 1.80550950406603, 2.14712474844036, 2.14712474844036, 
2.37618413862639, 0, 0, 0, 0, 0, 1.80550950406603, 2.37618413862639, 
0, 2.37618413862639, 2.14712474844036, 0, 3.42835366591009, 3.95395514204289, 
4.39153946529161, 3.8181877309365, 2.37618413862639, 0, 0, 0, 
2.88734446548044, 2.11096769918679, 2.51037780725583, 2.33616978566337, 
2.98535914973356, 2.65440135387150, 2.98535914973356, 1.77510517087316, 
2.51037780725583, 3.07457234475636, 1.77510517087316, 0, 2.33616978566337, 
2.98535914973356, 2.11096769918679, 3.65630330777027, 3.49338864171756, 
3.15663297601737, 4.22193539810782, 4.98106273377854, 5.899484260135, 
4.25453963683082, 2.88734446548044)), .Names = c("Stn", "Depth_m", 
"Species", "Stage", "Abundance_per_m3", "Depth_mF", "SpeciesF", 
"logAbundance_per_m3"), row.names = c(NA, -286L), class = "data.frame")

I'm relatively new to R, and I wondered if anyone could help me with a barchart I'm trying to create with the lattice package. I've managed to create the plot below (can't post because I'm a new user). Each panel represents the abundance of a separate species, while the bars represent the stacked abundances of larval stages of each species at specific depths. The problem is that I'd like to present the depths in a more intuitive way, with 0 m at the top of each panel, and 90 m at the bottom - this means 'flipping' the axis along with the bars. I created this plot using the following code:

    # create a new column for Species and Depth as factors
    stn8_9$Depth_mF<-as.factor(stn8_9$Depth_m)
    stn8_9$SpeciesF<-as.factor(stn8_9$Species)

    # log root transform data
    stn8_9$logAbundance_per_m3<-(stn8_9$Abundance_per_m3)^(1/4) 

    # now create chart
    barchart(Depth_mF~logAbundance_per_m3 | SpeciesF,
    data=stn8_9[stn8_9$SpeciesF!="CYP" & stn8_9$Stn==9,],
    horiz=TRUE, ylab="depth (m)",xlab="Abundance (#/m3)", 
    main="Station 9", origin=0,
    col=c("red","orange","yellow","green","blue","purple"),
    stack=TRUE, groups=stn8_9$Stage,
    key=
    list(title="Stage", cex.title=1,text=list(c("1","2","3","4","5","6")),
    space="right", rectangles=list(size=2,border="white",
    col=c("red","orange","yellow","green","blue","purple"))))

The dataset is provided at the bottom (hope it's in the right format)

I understand that barchart turns my 'depth' values into factors, and I have tried using reorder() and relevel(), and have managed to get the axis labels to flip, but the bars remain in the same place (not sure why). I'd like the '0 m' bar at the top, and the '90 m' bar at the bottom - can anyone please help?

Dataset:

 dput(stn8_9)
structure(list(Stn = c(9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L), Depth_m = c(90L, 90L, 90L, 90L, 90L, 90L, 90L, 
90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 
90L, 90L, 90L, 90L, 90L, 90L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 
60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 
60L, 60L, 60L, 60L, 60L, 60L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 
40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 
40L, 40L, 40L, 40L, 40L, 40L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 
70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 
70L, 70L, 40L, 40L, 40L, 40L, 40L, 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4L, 5L, 6L, 2L, 3L, 4L, 5L, 
6L, 2L, 3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 
6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 
7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 
2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 
2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 
3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 
3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 7L, 2L, 
3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 
4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 
4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 
5L, 6L, 7L, 2L, 3L, 4L, 5L, 6L, 2L, 3L, 4L, 5L, 6L), Abundance_per_m3 = c(0, 
0, 0, 1.267024758, 1.267024758, 0, 0, 0, 0, 0, 5.068099033, 0, 
0, 0, 0, 25.34049517, 0, 0, 3.801074275, 0, 0, 2.534049517, 7.60214855, 
12.67024758, 6.335123791, 0, 0, 0, 0, 3.044963144, 4.059950858, 
2.029975429, 1.014987715, 4.059950858, 5.074938573, 7.104914002, 
3.044963144, 0, 2.029975429, 0, 0, 30.44963144, 0, 0, 4.059950858, 
2.029975429, 0, 11.16486486, 4.059950858, 11.16486486, 2.029975429, 
1.014987715, 0, 0, 0, 0, 0, 9.899386594, 4.949693297, 15.83901855, 
16.82895721, 10.88932525, 3.959754638, 6.929570616, 0, 0, 0, 
24.74846649, 0, 0, 5.939631957, 0, 0.989938659, 1.979877319, 
0.989938659, 1.979877319, 0.989938659, 1.979877319, 0, 0, 0, 
0, 0, 17.89544764, 1.988383071, 9.941915354, 5.965149212, 7.953532283, 
0, 15.90706457, 3.976766141, 1.988383071, 0, 23.86059685, 1.988383071, 
9.941915354, 1.988383071, 0, 0, 0, 9.941915354, 61.63987519, 
51.69795984, 9.941915354, 0, 0, 0, 0, 0, 28.83473086, 48.05788476, 
33.64051933, 14.41736543, 0, 4.805788476, 38.44630781, 4.805788476, 
0, 0, 28.83473086, 19.2231539, 28.83473086, 43.25209628, 33.64051933, 
0, 72.08682714, 163.3968082, 692.0335406, 321.9878279, 86.50419257, 
0, 0, 0, 0, 0, 19.85102993, 9.925514965, 9.925514965, 29.7765449, 
0, 9.925514965, 39.70205986, 19.85102993, 0, 0, 29.7765449, 9.925514965, 
29.7765449, 9.925514965, 19.85102993, 0, 29.7765449, 178.6592694, 
744.4136224, 416.8716286, 49.62757483, 0, 0, 0, 0, 0, 11.25305392, 
3.215158262, 12.86063305, 16.07579131, 8.037895656, 19.29094957, 
6.430316525, 4.822737393, 0, 0, 51.4425322, 1.607579131, 3.215158262, 
1.607579131, 1.607579131, 1.607579131, 1.607579131, 8.037895656, 
6.430316525, 1.607579131, 1.607579131, 0, 0, 0, 0, 0, 30.07822022, 
12.03128809, 15.03911011, 15.03911011, 9.023466065, 13.5351991, 
6.015644043, 0, 1.503911011, 0, 27.07039819, 0, 6.015644043, 
3.007822022, 0, 1.503911011, 9.023466065, 25.56648718, 16.54302112, 
15.03911011, 6.015644043, 0, 0, 0, 4.939940207, 0, 39.51952166, 
14.81982062, 4.939940207, 4.939940207, 4.939940207, 0, 4.939940207, 
4.939940207, 0, 0, 29.63964124, 4.939940207, 4.939940207, 14.81982062, 
0, 0, 29.63964124, 197.5976083, 568.0931238, 261.816831, 54.33934228, 
0, 0, 0, 10.62671701, 0, 21.25343402, 10.62671701, 21.25343402, 
21.25343402, 31.88015104, 0, 0, 0, 0, 0, 10.62671701, 31.88015104, 
0, 31.88015104, 21.25343402, 0, 138.1473212, 244.4144913, 371.9350954, 
212.5343402, 31.88015104, 0, 0, 0, 69.50153499, 19.85758143, 
39.71516285, 29.78637214, 79.4303257, 49.64395357, 79.4303257, 
9.928790713, 39.71516285, 89.35911642, 9.928790713, 0, 29.78637214, 
79.4303257, 19.85758143, 178.7182328, 148.9318607, 99.28790713, 
317.7213028, 615.5850242, 1211.312467, 327.6500935, 69.50153499
), Depth_mF = structure(c(7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 6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 6L, 6L, 6L, 6L, 
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 
5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 1L, 1L, 1L, 1L, 1L, 2L, 
2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 
6L, 6L, 6L, 6L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 
3L, 3L, 3L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 1L, 1L, 
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 5L, 5L, 
5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 
2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 
6L, 6L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 
3L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L), .Label = c("BB", 
"BC", "CH", "CYP", "SB", "VS"), class = "factor"), logAbundance_per_m3 = c(0, 
0, 0, 1.06095331789381, 1.06095331789381, 0, 0, 0, 0, 0, 1.50041457128417, 
0, 0, 0, 0, 2.24364310060701, 0, 0, 1.39629309072760, 0, 0, 1.26169323444953, 
1.6604816781224, 1.88667144022303, 1.58649525090772, 0, 0, 0, 
0, 1.32097777276068, 1.41948299515758, 1.19363816214162, 1.00372605177853, 
1.41948299515758, 1.50092052805914, 1.63263727001607, 1.32097777276068, 
0, 1.19363816214162, 0, 0, 2.34906757441938, 0, 0, 1.41948299515758, 
1.19363816214162, 0, 1.82794602415898, 1.41948299515758, 1.82794602415898, 
1.19363816214162, 1.00372605177853, 0, 0, 0, 0, 0, 1.77378946506859, 
1.49157320259098, 1.99495023677811, 2.02541630374003, 1.81656207258872, 
1.41064284060004, 1.62246964847031, 0, 0, 0, 2.23042217070931, 
0, 0, 1.56113292684677, 0, 0.99747511829459, 1.18620450786389, 
0.99747511829459, 1.18620450786389, 0.99747511829459, 1.18620450786389, 
0, 0, 0, 0, 0, 2.05676958572452, 1.18747647396250, 1.77569149802404, 
1.562806928309, 1.67934533442396, 0, 1.99708942036914, 1.41215547164577, 
1.18747647396250, 0, 2.21014275343154, 1.18747647396250, 1.77569149802404, 
1.18747647396250, 0, 0, 0, 1.77569149802404, 2.80198262342921, 
2.68144165217603, 1.77569149802404, 0, 0, 0, 0, 0, 2.31728246613553, 
2.63294121550744, 2.40832821053419, 1.94859451890365, 0, 1.48061165227674, 
2.49008206159717, 1.48061165227674, 0, 0, 2.31728246613553, 2.09390107914848, 
2.31728246613553, 2.56449460796253, 2.40832821053419, 0, 2.91382843883587, 
3.57528685520031, 5.12898921614741, 4.23603815839925, 3.04971523426329, 
0, 0, 0, 0, 0, 2.11079356271994, 1.77495874023182, 1.77495874023182, 
2.33597707218005, 0, 1.77495874023182, 2.5101707230885, 2.11079356271994, 
0, 0, 2.33597707218005, 1.77495874023182, 2.33597707218005, 1.77495874023182, 
2.11079356271994, 0, 2.33597707218005, 3.65600169507374, 5.2234035271001, 
4.51856552762811, 2.65418238899045, 0, 0, 0, 0, 0, 1.83154502725781, 
1.33906170112536, 1.89371921865949, 2.00236428275782, 1.68378094745549, 
2.09574482014368, 1.59242170246783, 1.48191537399859, 0, 0, 2.67812340235484, 
1.12601218427985, 1.33906170112536, 1.12601218427985, 1.12601218427985, 
1.12601218427985, 1.12601218427985, 1.68378094745549, 1.59242170246783, 
1.12601218427985, 1.12601218427985, 0, 0, 0, 0, 0, 2.34187135068818, 
1.86242173581786, 1.96927122377906, 1.96927122377906, 1.73317871692943, 
1.91807754972377, 1.56610376120967, 0, 1.10740258963914, 0, 2.28099146904783, 
0, 1.56610376120967, 1.31693103877130, 0, 1.10740258963914, 1.73317871692943, 
2.24862878114404, 2.01675761776174, 1.96927122377906, 1.56610376120967, 
0, 0, 0, 1.49083789392989, 0, 2.50728048152353, 1.96205300969286, 
1.49083789392989, 1.49083789392989, 1.49083789392989, 0, 1.49083789392989, 
1.49083789392989, 0, 0, 2.33328739913925, 1.49083789392989, 1.49083789392989, 
1.96205300969286, 0, 0, 2.33328739913925, 3.74925881222597, 4.88207990404496, 
4.02253091444491, 2.71505476657560, 0, 0, 0, 1.80550950406603, 
0, 2.14712474844036, 1.80550950406603, 2.14712474844036, 2.14712474844036, 
2.37618413862639, 0, 0, 0, 0, 0, 1.80550950406603, 2.37618413862639, 
0, 2.37618413862639, 2.14712474844036, 0, 3.42835366591009, 3.95395514204289, 
4.39153946529161, 3.8181877309365, 2.37618413862639, 0, 0, 0, 
2.88734446548044, 2.11096769918679, 2.51037780725583, 2.33616978566337, 
2.98535914973356, 2.65440135387150, 2.98535914973356, 1.77510517087316, 
2.51037780725583, 3.07457234475636, 1.77510517087316, 0, 2.33616978566337, 
2.98535914973356, 2.11096769918679, 3.65630330777027, 3.49338864171756, 
3.15663297601737, 4.22193539810782, 4.98106273377854, 5.899484260135, 
4.25453963683082, 2.88734446548044)), .Names = c("Stn", "Depth_m", 
"Species", "Stage", "Abundance_per_m3", "Depth_mF", "SpeciesF", 
"logAbundance_per_m3"), row.names = c(NA, -286L), class = "data.frame")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

誰認得朕 2024-12-13 07:19:34

我希望我的理解是正确的,因为我只看到从 5 到 90 米的米,没有一个是 0 的。但是如果你简单地将该变量设为一个有序因子,其值“反向”排序,你就会得到我认为的结果描述:

d$Depth_mF <- factor(d$Depth_m,
                     levels = rev(sort(unique(d$Depth_m))),
                     ordered = TRUE)

在此处输入图像描述

I hope I'm reading you correctly, as I saw only meters from 5 up to 90, none with 0. But if you simply make that variable an ordered factor with the values ordered "in reverse" you'll get what I think you describe:

d$Depth_mF <- factor(d$Depth_m,
                     levels = rev(sort(unique(d$Depth_m))),
                     ordered = TRUE)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文