| gdd_analyze | R Documentation |
Non-interactive, fully parameter-driven entry point for the
degree-day module, in the same style as
lifeTable_analyze and lc50_analyze. It
(1) obtains the long-format data — user-supplied column vectors
(temp = d$T, duration = d$days, group = d$stage), a whole
data frame, or a csv/xlsx file / folder read via
gdd_read —, (2) optionally validates the data with
gdd_check (including the linear-range check),
(3) fits the chosen model — or selects the best model per group
by AICc with model = "auto" — via gdd_calc
and (4) optionally draws the fitted curves with
gdd_plot — in the same style as the
lc50_analyze entry point of the bioassay module.
Nothing is written to disk unless plot_file is supplied;
tabular export is handled separately by gdd_export.
gdd_analyze(
temp = NULL,
duration = NULL,
group = NULL,
data = NULL,
path = NULL,
temp_col = NULL,
duration_col = NULL,
by = NULL,
model = c("linear", "logan", "lactin", "briere1", "briere2", "wang", "auto"),
start = NULL,
conf_level = 0.95,
min_n = 3,
maxiter = 1000,
check = TRUE,
encoding = "UTF-8",
header = TRUE,
temp_from_file = FALSE,
pattern = "\\.(csv|xlsx|xls)$",
plot = FALSE,
plot_file = NULL,
plot_group = NULL,
show_C = TRUE,
show_Topt = 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,
...
)
temp, duration, group |
User-supplied column vectors, e.g.
|
data |
A data.frame in the long format required by
|
path |
Optional; path to a csv/xlsx file or a folder (batch
mode), read with |
temp_col, duration_col |
Column names; auto-detected by default (ignored when the column vectors are supplied). |
by |
Grouping variable(s), e.g. |
model |
Single model name or |
start |
Optional named list of starting values for a nonlinear
model, e.g. |
conf_level |
Confidence level, default 0.95. |
min_n |
Minimum rows per group, default 3. |
maxiter |
Iteration limit passed to the nonlinear fitter. |
check |
Logical; whether to validate the data with
|
encoding, header, temp_from_file, pattern |
Reading options for
|
plot |
Logical; whether to draw the fitted curves (default
|
plot_file |
Optional png path: when supplied together with
|
plot_group, show_C, show_Topt |
Plot options, see
|
plot_title |
Custom plot title; |
plot_sub |
Custom subtitle; |
plot_xlab, plot_ylab |
Custom axis labels; |
plot_family |
Text font family, see |
plot_width, plot_height |
Physical size of the exported figure
in |
plot_units |
Unit of |
plot_res |
Resolution (dpi) of the exported png, default 150.
Higher values add pixels (sharper print) without changing the
layout or the physical size. E.g. a journal requiring 300 dpi at
8 cm width: |
... |
Further arguments passed to |
A list with components:
data |
the long-format data actually analysed |
check |
the |
fit |
the |
plot_file |
the png path when |
gdd_read, gdd_check,
gdd_calc, gdd_plot,
gdd_predict, gdd_compare,
gdd_export, gdd_export_plot,
gdd_daily
f <- system.file("extdata", "gdd_example.csv", package = "insectecol")
## --- way 1 (recommended): read the file yourself, pass columns in ---
## Typical when many data sets live in one csv: the user reads the
## file and picks the columns with $, exactly like lifeTable_analyze()
d <- read.csv(f)
out1 <- gdd_analyze(temp = d$temp, duration = d$duration, group = d$stage)
out1$fit$results # C, K, SE and CI per stage
summary(out1$fit) # detailed coefficient tables
## Without a grouping column: one overall model
out1b <- gdd_analyze(temp = d$temp, duration = d$duration)
## --- way 2: pass the whole data frame ---
out2 <- gdd_analyze(data = d, by = "stage")
gdd_predict(out2$fit, temp = c(20, 25), group = "Egg")
## --- way 3: let the function read the file ---
out3 <- gdd_analyze(path = f, by = "stage")
## --- AICc model selection + png export + custom labels ---
## plot_title / plot_xlab / plot_ylab accept custom labels; Chinese
## labels are rendered through the device's font fallback
out4 <- gdd_analyze(temp = d$temp, duration = d$duration, group = d$stage,
model = "auto", plot = TRUE,
plot_file = tempfile(fileext = ".png"))
out4$fit$comparison # full comparison table, best flag included
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.