View source: R/emergence_main.R
| emergence_analyze | R Documentation |
Non-interactive, fully parameter-driven entry point for the
emergence-period module (the stage-grading method: one field
survey of the population stage structure — e.g. a
dissected-sample count of pupal grades — is turned into the
projected eclosion dates of the 16
the beginning, peak and end of the adult emergence period). In
the same style as gdd_analyze and
lc50_analyze, it (1) obtains the data — user
column vectors (stage = d$stage, count = d$n, days =
d$days), a whole data frame, or a csv/xlsx file / folder read
via emergence_read —, (2) computes the
cumulative development and the interpolated quantile dates via
emergence_calc and (3) optionally draws the
projection with plot.emergence. Larval hatch dates
are projected as well when pre_ovip / egg_days
are supplied. Nothing is written to disk unless plot_file
is supplied; tabular export is handled separately by
emergence_export.
emergence_analyze(
stage = NULL,
count = NULL,
percent = NULL,
days = NULL,
data = NULL,
path = NULL,
stage_col = NULL,
count_col = NULL,
percent_col = NULL,
days_col = NULL,
survey_date,
p = c(0.16, 0.5, 0.84),
labels = NULL,
pre_ovip = 0,
egg_days = 0,
encoding = "UTF-8",
header = TRUE,
pattern = "\\.(csv|xlsx|xls)$",
plot = FALSE,
plot_file = NULL,
show_hatch = TRUE,
plot_title = NULL,
plot_sub = NULL,
plot_xlab = NULL,
plot_ylab = NULL,
plot_family = NULL,
plot_width = 10.67,
plot_height = 6,
plot_units = c("in", "cm", "px"),
plot_res = 150,
...
)
stage, count, days |
User-supplied column vectors, e.g.
|
percent |
Alternative to |
data |
A data.frame with a stage column, a count (or
percent) column and a days column. Used when the vectors are
not supplied; takes precedence over |
path |
Optional; path to a csv/xlsx file or a folder (batch
mode), read with |
stage_col, count_col, percent_col, days_col |
Column names; auto-detected by default (ignored when the column vectors are supplied). |
survey_date |
The survey date: a |
p |
Numeric vector of emergence quantiles, default
|
labels |
Optional labels of the quantiles, see
|
pre_ovip |
Pre-oviposition period in days (default 0 = not used). Counted from female eclosion to egg deposition. |
egg_days |
Egg duration in days (default 0 = not used). |
encoding, header, pattern |
Reading options for
|
plot |
Logical; whether to draw the projection (default
|
plot_file |
Optional png path: when supplied together with
|
show_hatch |
Plot option, see |
plot_title, plot_sub, plot_xlab, plot_ylab |
Plot options
(title, subtitle, axis labels); |
plot_family |
Text font family, see |
plot_width, plot_height, plot_units, plot_res |
Physical size
and resolution of the exported png (only used when
|
... |
Further arguments passed to |
A list with components:
data |
the survey table actually analysed |
fit |
the |
plot_file |
the png path when |
emergence_read,
emergence_calc, emergence_export,
emergence_export_plot
f <- system.file("extdata", "emergence_example.csv",
package = "insectecol")
## --- way 1 (recommended): read the file yourself, pass columns in ---
d <- read.csv(f)
out <- emergence_analyze(stage = d$stage, count = d$count,
days = d$days, survey_date = "2026-03-20")
out$fit # three quantile dates
out$fit$table # cumulative development
predict(out$fit, c(0.25, 0.75)) # arbitrary quantiles
## --- way 2: pass the whole data frame ---
out2 <- emergence_analyze(data = d, survey_date = "2026-03-20")
## --- way 3: let the function read the file ---
out3 <- emergence_analyze(path = f, survey_date = "2026-03-20")
## --- hatch projection + png export + custom labels ---
## plot_title / plot_xlab / plot_ylab accept custom labels; Chinese
## labels are rendered through the device's font fallback (SimSun
## on Chinese Windows)
out4 <- emergence_analyze(path = f, survey_date = "2026-03-20",
pre_ovip = 3, egg_days = 10,
plot = TRUE,
plot_file = tempfile(fileext = ".png"))
out4$fit$predictions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.