0

I am trying to reorder the populations on a credibilityIntervals plot under the packages tRophicPosition. I have made the trophic position plot successfully but would like to reorder the communties produced to be smallest to largest. I dont know why they have produced in the order they have, as it is not the order on the inputted data sheet or in order of smallest to largest. This is the code i have so far:

mydata <- read.table(file="trophicposallpop.csv", header=T, sep=";")
str(mydata)
head(mydata)

OoList <- extractIsotopeData(mydata, 
                             b1 = "baseline",
                             baselineColumn = "FG",
                             consumersColumn = "Spp",
                             groupsColumn = "Community",
                             d13C = "d13C",
                             d15N = "d15N")

str(OoList)

for (community in OoList) {
  print(summary(community))
  plot(community)
}



Oo_models <- multiSpeciesTP(OoList, model = "oneBaseline",
                            n.adapt = 10000, n.iter = 20000,
                            burnin = 10000, n.chains = 5, print = FALSE)
                                 

credibilityIntervals(Oo_models$df, x = "group", xlab ="Community", y1lim=c(2,10),
                     plotAlpha = F, group_by = "group",
                     scale_colour_manual = c("pink1","turquoise4","turquoise1","magenta","skyblue1","maroon","orchid","aquamarine",
                                                    "aquamarine4","slateblue2","tomato","blue","blue4","orange","burlywood1", 
                                                     "red", "red4", "green", "darkolivegreen3", "darkgreen", "purple", "yellow",
                                                     "grey"))
                                                         

getPosteriorMode(Oo_models$"TPs")

i am not sure how to change this order. this is an example of my input data

> dput(head(mydata, 100))

structure(list(Spp = c("Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo"), FG = c("Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo", "Oo"), d13C = c("-17.54", "-16.76", "-16.46", "-16.79", "-16.88", "-16.27", "-16.82", "-17.12", "-17", "-16.77", "-17", "-15.54", "-15.38", "-15.21", "-15.22", "-15.31", "-15.63", "-16.24", "-15.34", "-15.44", "-23.7", "-24.1", "-23.6", "-23.8", "-23.9", "-23.5", "-24.1", "-24.1", "-23.9", "-24", "-24", "-24", "-23.7", "-23.8", "-23.9", "-23.6", "-23.7", "-24", "-23.8", "-23.8", "-23.5", "-23.4", "-23.8", "-24.1", "-24.2", "-23.9", "-23.9", "-23.9", "-23.7009048457524", "-24.0058067973601", "-24.6214005339012", "-23.9156056521964", "-24.0763056482644", "-23.3870299175515", "-23.5929466049739", "-21.72", "-22.29666667", "-22.29", "-22.34", "-22.14", "-22.20333333", "-22.43", "-22.58333333", "-22.68", "-23.02333333", "-22.85333333", "-23.10666667", "-22.31666667", "-23.28333333", "-22.88666667", "-22.74333333", "-22.67", "-22.63666667", "-22.69333333", "-19.3", "-19.4", "-19.7", "-19.5", "-20", "-19.8", "-19.8", "-19", "-20.4", "-20.3", "-20", "-19.8", "-19.9", "-19.9", "-19.4", "-19.7", "-19.8", "-20.9", "-20", "-19.4", "-19.5", "-19.6", "-19.4", "-19.6", "-19.4", "-19"), d15N = c(12.61, 12.47, 12.7, 12.27, 12.19, 12.66, 12.54, 13.09, 12.57, 12.92, 13.29, 14.11, 14.64, 14.54, 14.99, 14.35, 14.9, 14.86, 15.21, 14.89, 13.3, 13.1, 13.4, 14.1, 12.8, 13.7, 13.2, 13.4, 13.1, 12.9, 13.3, 12.9, 12.9, 13.5, 13.3, 13.6, 13.7, 12.6, 13, 12.9, 13.6, 13.5, 13.4, 12.8, 12.8, 12.5, 13, 13.1, 14.772965955515, 14.543420057106, 14.1976454133271, 15.0356464765395, 13.5680018534348, 14.9187166118854, 14.4636036321922, 12.73666667, 11.73333333, 12.45666667, 11.91, 12.52333333, 12.14, 11.89666667, 12.1, 11.63666667, 12.60333333, 12.32, 11.18333333, 11.54, 11.59333333, 11.15333333, 11.30666667, 11.215, 11.37666667, 11.07, 11.9, 11.7, 11.7, 12, 11.9, 12.7, 11.7, 11.2, 11.8, 10.9, 11.8, 11.8, 11.4, 11.2, 11.7, 12.5, 11.3, 12.9, 11.5, 11.6, 11.7, 11.7, 11.7, 11.8, 11.9, 11.7), Community = c("SoG", "SoG", "SoG", "SoG", "SoG", "SoG", "SoG", "SoG", "SoG", "SoG", "SoG", "CI", "CI", "CI", "CI", "CI", "CI", "CI", "CI", "CI", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticC", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "AntarcticB", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA", "NorwayA")), row.names = c(NA, 100L), class = "data.frame")

  • Please run `dput(head(mydata, 50))` and copy the result into your question. If 50 rows isn't enough to replicate your issue, increase that value until it does. This will help make answering your question easier. Thanks – L Tyrone Apr 19 '23 at 01:07
  • I have just added that in now, hopefully that helps. Thanks Hannah – hannahmarinebio Apr 19 '23 at 08:34

0 Answers0