mtgrank: Ranks of vertices in a decomposition

View source: R/mtgrank.R

mtgrankR Documentation

Ranks of vertices in a decomposition

Description

Computes the rank of the vertices contained in an object of class foldermtg. The vertex sequences resulting from a decomposition of other vertices, the rank of the vertices making up the sequences are computed from the beginning of the sequence or from its end. These ranks can be absolute or relative.

For example: ranks of the phytomeres and inflorescences in each stem.

Usage

mtgrank(x, classe, parent.class = NULL, sibling.classes = NULL,
  relative = FALSE, from = c("origin", "end"), rank.name = "Rank",
  display = FALSE)

Arguments

x

an object of class foldermtg.

classe

character. The class of the vertices for which the ranks are computed.

parent.class

character. The class of the parent entities of those for which the ranks are computed. If omitted, the entities of scale maxscal - 1, where maxscal is the highest scale in x data.

sibling.classes

character vector. The classes of vertices appearing at the same scale as classe, which are used in the computing of the ranks.

If omitted, only the vertices of class classe are used to compute the ranks.

relative

logical. If TRUE, the relative ranks are computed, i.e. ranks from 0 to 1. Default: FALSE.

from

character. It can be "origin" (default) or "end".

If from = "origin", the ranks are computed from the origin to the end, i.e. from 1 to its maximum (from 0 to 1 if relative = TRUE). If from = "end", they are computed from the end to the origin, i.e. from the maximum to 1 (from 1 to 0 if relative = TRUE).

rank.name

character. Name of the rank column that is appended to x[[classe]]. The default is "Rank".

display

logical. If TRUE, the data frames of x corresponding to classes are displayed. Default: FALSE.

Details

If the branching orders of the entities given by classe, parent.class and, if relevant, sibling.classes are not contained in x, mtgrank() uses mtgorder to compute them. The ranks are appended to the data frames containing the vertices (one data frame per class) and the values of their corresponding features.

Value

Returns an object of class foldermtg, that is a list of data frames.

Author(s)

Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard

References

Pradal, C., Godin, C. and Cokelaer, T. (2023). MTG user guide

See Also

read.mtg: reads a MTG file and builds an object of class foldermtg.

mtgorder.

Examples

mtgfile <- system.file("extdata/plant1.mtg", package = "dad")
xmtg <- read.mtg(mtgfile)

ymtg <- mtgrank(xmtg, "M")
print(ymtg)

mtgrank(xmtg, "M", display = TRUE)

mtgrank(xmtg, "M", parent.class = "A", display = TRUE)
mtgrank(xmtg, "M", parent.class = "A", sibling.classes = c("O", "I"), display = TRUE)
mtgrank(xmtg, "M", relative = TRUE, display = TRUE)
mtgrank(xmtg, "M", from = "origin", display = TRUE)
mtgrank(xmtg, "M", from = "end", display = TRUE)

dad documentation built on Aug. 30, 2023, 5:06 p.m.