| lc50_analyze | R Documentation |
Non-interactive, fully parameter-driven entry point for the LC
(lethal concentration) analysis. It (1) assembles the standardised
data list from a data frame, a named list of data frames or three
parallel vectors, (2) computes the LC estimates with the selected
method(s) via lc50_calculate and (3) optionally builds
the regression plot(s) in the style of lc50_plot,
optionally written to disk as png when plot_file is supplied.
Tabular export is handled separately by lc50_export.
lc50_analyze(
d = NULL,
concentration = NULL,
tested = NULL,
dead = NULL,
name = "bioassay",
lc = 0.5,
method = "traditional",
plot = FALSE,
plot_file = NULL,
plot_width = 12,
plot_height = 8,
plot_units = "cm",
plot_res = 300,
plot_method = NULL,
font = "TNM",
unit = NULL,
shape = c("sigmoid", "linear"),
ci = TRUE,
ci_level = 0.95,
error_bar = TRUE,
move_thres = 0.5,
lc_ci = TRUE,
lc_p = TRUE,
lc_lab_gap = 0.35,
lc_lab_gap_right = 0.1,
lc_lab_dy = 0.1,
lc_lab_lh = 1.05
)
d |
Optional; the bioassay data: a data frame with the columns
|
concentration, tested, dead |
Numeric vectors; the concentration,
the number of insects tested and the number of dead insects, one
entry per concentration group (replicates = repeated values).
Used only when |
name |
Character; the data set name used in the results and the
saved plot file names when |
lc |
Numeric; the lethal proportion (default 0.5 = LC50,
e.g. 0.9 = LC90), passed to |
method |
Character; one or several of |
plot |
Logical; whether to build the regression plot(s)
(default |
plot_file |
Optional png path: when supplied together with
|
plot_width, plot_height, plot_units, plot_res |
Physical size and
resolution of the exported png (only used when |
plot_method |
Character; which of the computed methods to plot
(default |
font, unit, shape, ci, ci_level, error_bar, move_thres, lc_ci, lc_p, lc_lab_gap, lc_lab_gap_right, lc_lab_dy, lc_lab_lh |
Plot settings, passed to the internal plot engine exactly as in
|
A list with elements data (the standardised data
list, one data frame per data set), results (the list
returned by lc50_calculate: results,
summary_df, lc), plot (a named list of
ggplot objects when plot = TRUE, otherwise NULL)
and plot_file (the written path(s) when plot_file
was supplied, otherwise NULL).
lc50_read, lc50_calculate,
lc50_plot, lc50_export,
lc50_export_plot
## way 1: data frame straight from the package example csv
f <- system.file("extdata", "lc50_example.csv", package = "insectecol")
out1 <- lc50_analyze(lc50_read(f), method = "probit")
out1$results$summary_df
## way 2: three parallel vectors, no csv involved; all three methods
conc <- c(0, 1.5, 3, 6, 12, 24)
n <- c(120, 60, 60, 60, 60, 60)
dead <- c(7, 9, 18, 32, 48, 57)
out2 <- lc50_analyze(concentration = conc, tested = n, dead = dead,
name = "trial1", method = "all")
out2$results$summary_df
## way 3: LC90, improved regression, plot on the linear axis
out3 <- lc50_analyze(concentration = conc, tested = n, dead = dead,
name = "trial1", lc = 0.9, method = "improved",
plot = TRUE, plot_method = "improved",
shape = "linear")
out3$plot$trial1 # ggplot object: print(), customise or export
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.