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

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. Parameter set index syntax is supported. When used, format_mega_kernel will produce as many mega-matrices as there are combinations of par_set_indices 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 index syntax (i.e. f_forms = "F_yr + C_yr"). Only applies to age X size models. The "_age" index 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))