read.dm | R Documentation |
Read in diet compositional data in one of two formats. Data
stored as a compositional matrix can be read in using the read.dm
function. Data stored in a predator-prey format can be read in using the
read.pp
function.
read.dm(object = NULL, filenm = NULL, labels = list(DateL = "Date",
FullnessL = "Fullness"), Datef = "%d/%m/%Y", diet.ind.start,
p = 0.01, sp2omit = NULL, predsp = NULL)
read.pp(object = NULL, filenm = NULL, labels = list(PredatorL =
"PredID", TripSetL = "TripSetNo", SpeciesL = "Species", FullnessL =
"Fullness", DateL = "Date", WeightL = "Weight", PreyGrpL = "PreyGrp"),
Datef = "%d/%m/%Y", p = 0.01, Xvars, sp2omit = NULL)
object |
matrix. A compositional data matrix containing covariate information and diet composition for each predator (optional). |
filenm |
file name. A file name specifying the location of a comma delimited file that contains the covariate information and diet composition for each predator (optional). |
labels |
a list containing the following:
|
Datef |
date format. See |
diet.ind.start |
integer. Column number where the diet composition data begins. |
p |
numeric. Proportion of prey to omit. If the composition is represented as a
wet weight, then |
sp2omit |
a vector of prey names to omit from the analysis (default: NULL) |
predsp |
Predator species names to extract from the data. |
Xvars |
a vector of covariate names that will be used in the analysis. |
The most common format for storing compositional data is matrix format. The
read.dm
function can then be used to read in the data. Occasionally data
will be stored in predator-prey format. In this instance read.pp
can
be used to read in the data. In either function, either an R object or file name
is required to read in the data.
a matrix where each row represents data for a separate predator-prey combination.
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.
# Reading in a diet matrix
#data(yftDMraw)
#write.csv(yftDMraw, file = "yftDMraw.csv", row.names = FALSE)
#yftpp1 <- read.dm(filenm = "yftDMraw.csv",
# labels = list(FullnessL = "Fullness", DateL = "Date"),
# Datef = "\%m/\%d/\%Y", diet.ind.start = 12, p = 0.01)
#data(PreyTaxonSort)
#val <- apc(x = yftpp1, preyfile = PreyTaxonSort, check = TRUE)
#node.colsY <- val$cols
#dietPP <- val$x # updated diet matrix with "Group" assigned prey taxa codes
#head(dietPP)
# Reading in a predator-prey matrix
#data(yftPPraw)
#write.csv(yftPPraw, file = "yftPPraw.csv", row.names = FALSE)
#yftpp2 <- read.pp(filenm = "yftPPraw.csv",
# labels = list(PredatorL = "TripSetPredNo", TripSetL = "TripSetNo",
# SpeciesL = "Family", FullnessL = "Fullness",
# DateL = "Date", WeightL = "PropW", PreyGrpL = "Family"),
# Datef = "\%m/\%d/\%Y", p = 0.01,
# Xvars = c("Lat", "Lon", "Year", "Quarter", "Length", "SST"))
#data(PreyTaxonSort)
#pal <- c(topo.colors(10)[1:2], heat.colors(10)[1:2], terrain.colors(25)[1:8])
#val <- apc(x = yftpp2, preyfile = PreyTaxonSort, palette = pal, check = TRUE)
#node.colsY <- val$cols
#dietPP <- val$x # updated diet matrix with prey taxa codes
#head(dietPP)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.