Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ipm_to_df

Convert ipmr matrix to long data frame


Description

Converts IPM kernels into long data frames. These are useful for creating plots using ggplot2.

Usage

ipm_to_df(ipm, ...)

## S3 method for class 'array'
ipm_to_df(ipm, ...)

## Default S3 method:
ipm_to_df(ipm, ..., mega_mat, name_ps = NULL, f_forms = NULL)

Arguments

ipm

Output from make_ipm.

...

Other arguments passed to methods.

mega_mat

A vector with symbols, I's, and/or 0s representing the matrix blocks. They should be specified in ROW MAJOR order! Can also be a character string specifying the call. Hierarchical syntax is supported. When used, format_mega_matrix will produce as many mega-matrices as there are combinations of levels_hier_effs in the proto_ipm.

name_ps

The prefix(es) for the kernel name that correspond to survival and growth/maturation of existing individuals. For the model K = P_age + F_age, this would be "P". Only applies to age X size models. The "_age" suffix is appended automatically, so does not need to be supplied.

f_forms

The names of the kernels that correspond to production of new individuals, and possibly, how they are combined. For example, a model that includes sexual (with an "F" kernel) and asexual reproduction (with a "C" kernel), this would be "F + C". If data come from multiple sites or years, then this information is supplied using the suffix syntax (i.e. f_forms = "F_yr + C_yr"). Only applies to age X size models. The "_age" suffix is appended automatically, so does not need to be supplied.

Value

A data frame with 3 columns named "t", "t_1", and "value".

Examples

data(gen_di_det_ex)

big_mat_df <- ipm_to_df(gen_di_det_ex,
                        mega_mat = c(stay_discrete, go_discrete,
                                     leave_discrete, P))

ipmr

Fits Integral Projection Models Using an Expression Based Framework

v0.0.1
MIT + file LICENSE
Authors
Sam Levin [aut, cre] (<https://orcid.org/0000-0002-3289-9925>), Aldo Compagnoni [aut], Dylan Childs [aut], Sanne Evers [aut], Roberto Salguero-Gomez [aut], Tiffany Knight [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.