apc | R Documentation |
Assigns prey colours to prey defined in dataset
apc(x, preyfile, palette = NULL, check = FALSE)
## S3 method for class 'diet'
apc(x, preyfile, palette = NULL, check = FALSE)
x |
diet object. Must be of class diet. |
preyfile |
prey file name that contains the prey groupings
and labels required for labelling the tree. The preyfile can be output
using the |
palette |
a vector of colours. This requires the user to set up a colour
palette where the number of colours equals the number of prey in |
check |
logical. If set to |
If a colour palette is not provided, then a palette will be automatically
derived based on the colour palettes available. For customised colour palettes,
users will need to define a palette
. If no palette is supplied and there
are more than 4 prey groups, the colour palette will default to rainbow.
A list with the following components:
colsa vector of node colours for each prey appearing in the diet matrix.
xthe updated diet matrix with prey groupings as specified in the PreyTaxonSort.csv file.
Kuhnert, P.M., Duffy, L. M and Olson, R.J. (2012) The Analysis of Predator Diet and Stable Isotope Data, Journal of Statistical Software, In Prep.
colors
; palette
; topo.colors
;
heat.colors
; terrain.colors
# Load the YFT diet data (of class diet)
#data(yftdiet)
#class(yftdiet)
# Load the prey taxa data
#data(PreyTaxonSort)
#PreyTaxonSort
# Example where no palette is given
#val <- apc(x = yftdiet, preyfile = PreyTaxonSort, palette = NULL, check = TRUE)
#node.colsY <- val$cols
#dietPP <- val$x # updated diet matrix with Group assigned prey taxa codes
#head(dietPP)
# Example where palette is given
#pal <- c(topo.colors(10)[1:2], heat.colors(10)[1:2], terrain.colors(25)[1:8])
#val <- apc(x = yftdiet, preyfile = PreyTaxonSort, palette = pal, check = TRUE)
#node.colsY <- val$cols
#dietPP <- val$x # updated diet matrix with Group assigned prey taxa codes
#head(dietPP)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.