View source: R/aggregateByGenet.R
aggregateByGenet | R Documentation |
This function aggregates a data.frame by unique trackIDs so that each row represents a genet (unique genetic individual) in a given year.
aggregateByGenet(
dat,
site = "Site",
quad = "Quad",
species = "Species",
year = "Year",
trackID = "trackID",
...
)
dat |
An sf data.frame. Typically this is a data.frame that has been
returned from the |
site |
A character string giving the name of the column in 'dat' that contains the values for site. The default is "Site". |
quad |
A character string giving the name of the column in 'dat' that contains the values for quadrat. The default is "Quad". |
species |
A character string giving the name of the column in 'dat' that contains the values for species. The default is "Species". |
year |
A character string giving the name of the column in 'dat' that contains the values for year. The default is "Year". |
trackID |
A character string giving the name of the column in 'dat' that contains the values for the unique identifier, or trackID. The default is "trackID". |
... |
Other arguments passed on to methods. Not currently used. |
This function is a plantTracker-specific, user-friendly
wrapper for the 'aggregate' function. This function was designed for use
within the trackSpp
function, but can be also called
independently by the user. The function is designed to take a data.frame of
the same format that is returned by trackSpp()
, but it can be used to
aggregate any dataset by genet (or some other unique identifier), as long as
there is a column that identifies genet (or unique identifier) identity for
each observation.
An sf data.frame that has been aggregated by genet so that each row represents one unique genetic individual in one year. This data.frame has columns containing data for site, quadrat, species, year, and trackID, as well as columns called 'basalArea_genet', 'age', 'recruit', 'survives_tplus1', 'nearEdge', and 'size_tplus1'. This data.frame will most likely be shorter than the input 'dat', because a genet that was previously broken into multiple rows representing each ramet in each year will now have only one row in each year.
This function is called inside the trackSpp()
function.
dat <- grasslandData[grasslandData$Site == c("AZ") &
grasslandData$Species %in% c("Bouteloua rothrockii", "Calliandra eriophylla" ),]
names(dat)[1] <- "speciesName"
inv <- grasslandInventory[unique(dat$Quad)]
outDat <- trackSpp(dat = dat,
inv = inv,
dorm = 1,
buff = .05,
buffGenet = 0.005,
clonal = data.frame("Species" = unique(dat$speciesName),
"clonal" = c(TRUE,FALSE)),
species = "speciesName",
aggByGenet = FALSE
)
aggregateByGenet(dat = outDat,
species = 'speciesName')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.