Package 'ssd4mosaic'

Title: Web Application for the SSD Module of the MOSAIC Platform
Description: Web application using 'shiny' for the SSD (Species Sensitivity Distribution) module of the MOSAIC (MOdeling and StAtistical tools for ecotoxICology) platform. It estimates the Hazardous Concentration for x% of the species (HCx) from toxicity values that can be censored and provides various plotting options for a better understanding of the results. See our companion paper Kon Kam King et al. (2014) <doi:10.48550/arXiv.1311.5772>.
Authors: Milena Kaag [cre, aut], Sandrine Charles [aut] , UMR5558 LBBE MEPS [cph, fnd], rhandsontable contributors [ctb, cph] (For my_rhandsontable function)
Maintainer: Milena Kaag <[email protected]>
License: MIT + file LICENSE
Version: 1.0.1
Built: 2024-12-15 07:40:00 UTC
Source: CRAN

Help Index


Add confidence interval(s) to an existing fitted distribution ggplot

Description

Add confidence interval(s) to an existing fitted distribution ggplot

Usage

add_CI_plot(base_plot, bts, logscale, CI.level = 0.95)

Arguments

base_plot

A ggplot object that depicts the fit(s) of the bootstrap(s).

bts

A list of bootdist or bootdistcens objects.

logscale

if TRUE, uses a logarithmic scale for the xx-axis

CI.level

A strictly positive numeric smaller than 1. The level of the confidence interval(s).

Value

A ggplot object.


Graphical representation of fitted distribution(s)

Description

base_cdf plots an empirical cdf of the toxicity values against one or several fitted distributions' cdf. It works for both censored and non censored data.

Usage

base_cdf(fits, unit, logscale, names = NULL, horizontals = TRUE, xlim = NULL)

Arguments

fits

A list of fits of class fitdist or fitdistcens computed from the same toxicity data.

unit

A character vector, the unit of the toxicity data

logscale

if TRUE, uses a logarithmic scale for the xx-axis

names

Label vector for data points (only for non censored data)

horizontals

If TRUE, draws horizontal lines for the step empirical cumulative distribution function (ecdf). See also plot.stepfun.

xlim

The xx-limits of the plot.

Value

A ggplot object.


Determines the appropriate bootstrap function based on a fit object

Description

Determines the appropriate bootstrap function based on a fit object

Usage

bootdist_fun(x, ft, niter = 200)

Arguments

x

Not used

ft

A fitdist or fitdistcens object

niter

An integer. The number of iterations set for the bootstrap function

Value

An appropriate bootstrap function.


Graphical representation of censored data

Description

cens_lines_plot create a plot representing each interval of toxicity values with a horizontal line, or a point if the bounds of the interval are equal. It is possible to color the lines by a grouping indicator.

Usage

cens_lines_plot(
  data,
  unit,
  logscale,
  fits = NULL,
  leftNA = 0,
  rightNA = Inf,
  color_group = FALSE
)

Arguments

data

A data.frame containing censored toxicity values. It must have columns left, right, and label if color_group = TRUE. Censored values are indicated with NA.

unit

A character vector, the unit of the toxicity data

logscale

if TRUE, uses a logarithmic scale for the xx-axis

fits

A list of fits of class fitdist or fitdistcens computed from the same toxicity data.

leftNA

The value to replace censored left values. Default to 0 because toxicity values are concentrations.

rightNA

The value to replace censored right values.

color_group

if TRUE, color the elements of the plot by the group label of the data (column label).

Value

A ggplot object.


Generate a script according to user in-app inputs

Description

Generate a script according to user in-app inputs

Usage

code_r_ssd(
  data,
  distributions,
  censored = FALSE,
  logscale = TRUE,
  unit = "arbitrary unit",
  names = FALSE,
  groups = FALSE,
  CI.level = 0.95
)

Arguments

data

If censored = TRUE, a data.frame with columns left and right. If censored = FALSE, a data.frame with a column conc.

distributions

A list of the names of the distributions to apply (e.g., 'lnorm', 'llogis')

censored

A Boolean, whether the given data is to be interpreted as censored

logscale

A logical

unit

A character string

names

A logical

groups

A logical

CI.level

A numerical

Value

A character string containing a R script.


Combine several bootstrap samples into a single bootdist or bootdistcens object

Description

Combine several bootstrap samples into a single bootdist or bootdistcens object

Usage

combine_boot_samples(bs)

Arguments

bs

A list of bootdist or bootdistcens objects obtained from the same fit object.

Value

A bootdist or bootdistcens object with a number of samples equal to the sum of number of samples of each bootstrap from the list input.


Custom ggplot theme created for MOSAIC bioacc overwriting theme_bw

Description

Custom ggplot theme created for MOSAIC bioacc overwriting theme_bw

Usage

custom_theme()

Summary of 48 to 96-hour acute toxicity values for endosulfan

Description

Summary of 48 to 96-hour acute toxicity values (LC50 and EC50 values) for exposure of Australian and Non-Australian taxa to endosulfan.

Usage

endosulfan

Format

endosulfan

A data frame with 88 rows and 3 columns:

conc

Lethal or effective concentration in μ\mug/L.

name

Specie's name for each concentration.

group

Classification by geographical origin and type: fish or arthropod.

Source

https://pubmed.ncbi.nlm.nih.gov/15499502/


48-hour acute toxicity values for fluazinam

Description

48-hour acute toxicity values (EC50 values) for exposure of macroinvertebrates and zooplancton to fluazinam.

Usage

fluazinam

Format

fluazinam

A data frame with 14 rows and 4 columns:

left, right

Lower & higher bounds of the effective concentration interval in μ\mug/L.

name

Specie's name for each effective concentration.

group

Classification of the specie, not all rows use the same taxonomic rank.

Source

https://pubmed.ncbi.nlm.nih.gov/19837458/


Generate bootstrap sample(s) for a list of fit(s) and check their convergence

Description

Generate bootstrap sample(s) for a list of fit(s) and check their convergence

Usage

get_bootstrap(fits)

Arguments

fits

A list of fitdist or fitdistcens objects

Value

A list of two lists. The first list contains the bootstrap sample(s) and the second one the logical value of convergence.


Fit the specified distributions to the given data

Description

Fit the specified distributions to the given data

Usage

get_fits(data, distributions, censored)

Arguments

data

If censored = TRUE, a data.frame with columns left and right. If censored = FALSE, a data.frame with a column conc.

distributions

A list of the names of the distributions to apply (e.g., 'lnorm', 'llogis')

censored

A Boolean, whether the given data is to be interpreted as censored

Value

A list containing the fit object(s) of class fitdist or fitdistcens.


Get HCx values from fit or bootstrap

Description

Get HC5, HC10, HC20 and HC50 for each fit provided, with confidence intervals if the corresponding bootstraps were provided.

Usage

get_HCx_table(fits, distributions, bootstrap = NULL, CI.level = 0.95)

Arguments

fits

A list of fits of class fitdist or fitdistcens computed from the same toxicity data.

distributions

A list of the names of the distributions to apply (e.g., 'lnorm', 'llogis')

bootstrap

A list of bootdist or bootdistcens objects corresponding to the fits provided.

CI.level

A numeric, either 0.95 or 0.9. The level of the confidence interval(s).

Value

A data.frame with different HCx as rows and different fits as columns.


Get fit(s) parameters in HTML format for shiny outputs

Description

Get fit(s) parameters in HTML format for shiny outputs. Should do nothing if the fit is not ready, and should display limited information if the bootstrap is not done.

Usage

get_parameters_html(fits = NULL, bootstrap = NULL, CI.level = 0.95)

Arguments

fits

A list of fits of class fitdist or fitdistcens computed from the same toxicity data.

bootstrap

A list of bootdist or bootdistcens objects corresponding to the fits provided.

CI.level

A numeric, either 0.95 or 0.9. The level of the confidence interval(s).

Details

The output should look like: (once bootstrap is done)

**Log normal distribution**

*(log-likelihood = -161.8)*

meanlog: 1.1 [ 0.66 ; 1.5 ]

sdlog: 1.6 [ 1.3 ; 1.9 ]

Value

A character string with HTML formatting.


Create a label for x axis based on concentration unit and log scale

Description

Create a label for x axis based on concentration unit and log scale

Usage

get_xlab(unit, logscale)

Arguments

unit

A character vector, the unit of the toxicity data

logscale

if TRUE, uses a logarithmic scale for the xx-axis

Value

A character vector.


Graphical representation of grouped toxicity censored data

Description

Create an empirical cdf representation colored according to a "group" attribute. The fitted distribution is also represented.

Usage

group_cdf_censored(fits, unit, logscale, data)

Arguments

fits

A list of fits of class fitdist or fitdistcens computed from the same toxicity data.

unit

A character vector, the unit of the toxicity data

logscale

if TRUE, uses a logarithmic scale for the xx-axis

data

A data.frame with columns left, right and group

Details

The plot represents each interval of toxicity values with a horizontal line, or a point if the bounds of the interval are equal, using function cens_lines_plot().

Value

A ggplot object.


Graphical representation of grouped toxicity uncensored data

Description

Add a group coloration to a provided empirical cdf representation according to a "group" column in data.

Usage

group_cdf_uncensored(data, p)

Arguments

data

A data.frame with columns conc and group.

p

a ggplot object showing the empirical cumulative distribution function of the uncensored data provided.

Value

A ggplot object.


Create a pretty confidence interval ggplot

Description

Create a pretty confidence interval ggplot

Usage

my_CIcdfplot(b, logscale, CI.level)

Arguments

b

One "bootdist" object.

logscale

if TRUE, uses a logarithmic scale for the xx-axis

CI.level

A strictly positive numeric smaller than 1. The level of the confidence interval(s).

Value

A ggplot with 7 or 8 layers.

Note

With a bootdist, the plot created has 8 layers. With a bootdistcens object, the plot created has 7 layers. The ribbon and its delimiting lines are always the last 3 layers.


Graphical representation of named toxicity censored data

Description

Add names to a provided empirical cumulative distribution function ggplot (i.e.,species names).

Usage

name_plot_censored(data, p, leftNA = 0, rightNA = Inf)

Arguments

data

A data.frame with column conc if uncensored data, with left and right if censored data. In any case, must contain a column name.

p

A ggplot object showing the empirical cumulative distribution function of the censored data provided.

leftNA

The value to replace censored left values. Default to 0 because toxicity values are concentrations.

rightNA

The value to replace censored right values.

Details

The positions of the names on the plot are based on the raw data visualization and not the non parametric maximum likelihood estimation (NPMLE) representation, but they can be added to both types of plot.

Compatible with plots colored by group labels.

Value

A ggplot object.


Graphical representation of named toxicity uncensored data

Description

Create an empirical cumulative distribution function ggplot with a name (i.e. species names) associated to each observation.

Usage

name_plot_uncensored(fits, unit, logscale, data, horizontals = TRUE)

Arguments

fits

A list of fits of class fitdist or fitdistcens computed from the same toxicity data.

unit

A character vector, the unit of the toxicity data

logscale

if TRUE, uses a logarithmic scale for the xx-axis

data

A data.frame with column conc if uncensored data, with left and right if censored data. In any case, must contain a column name.

horizontals

If TRUE, draws horizontal lines for the step empirical cumulative distribution function (ecdf). See also plot.stepfun.

Value

A ggplot object.


Graphical representation of toxicity data with additional elements

Description

Create an empirical cdf representation with the options to color data according to a group label and to display a name label for each observation.

Usage

options_plot(
  fits,
  unit,
  logscale,
  data,
  use_names = FALSE,
  use_groups = FALSE,
  horizontals = TRUE,
  lines_display = TRUE
)

Arguments

fits

A list of fits of class fitdist or fitdistcens computed from the same toxicity data.

unit

A character vector, the unit of the toxicity data

logscale

if TRUE, uses a logarithmic scale for the xx-axis

data

A data.frame with column conc if uncensored data, with left and right if censored data, column name if the names are to be displayed and column group if the groups are to be displayed.

use_names

if TRUE, name labels are added to the plot.

use_groups

if TRUE, data in the plot is colored by group.

horizontals

A boolean. In case of uncensored data, whether to draw horizontal lines for the step of the cumulative distribution function. Should be set to FALSE when use_group = TRUE for a better visual.

lines_display

A boolean. In case of censored data, whether to display the raw data or the non parametric maximum likelihood estimation (NPMLE) representation. Ignored when use_groups = TRUE. Raw data give a better visual with name labels.

Value

A ggplot object.


Take a data.frame of censored toxicity data and order them like fitdistrplus plots

Description

Take a data.frame of censored toxicity data and order them like fitdistrplus plots

Usage

order_cens_data(data)

Arguments

data

A data.frame of censored data with columns left and right

Value

A data.frame with ordered toxicity values.

Note

Left censored data are put in first, based on the value of their right bound, then non censored data are ordered based on their average value. The right censored data are put in last, ordered among themselves by their left bound.


Run the Shiny Application

Description

Run the Shiny Application

Usage

run_app(
  onStart = NULL,
  options = list(),
  enableBookmarking = NULL,
  uiPattern = "/",
  ...
)

Arguments

onStart

A function that will be called before the app is actually run. This is only needed for shinyAppObj, since in the shinyAppDir case, a global.R file can be used for this purpose.

options

Named options that should be passed to the runApp call (these can be any of the following: "port", "launch.browser", "host", "quiet", "display.mode" and "test.mode"). You can also specify width and height parameters which provide a hint to the embedding environment about the ideal height/width for the app.

enableBookmarking

Can be one of "url", "server", or "disable". The default value, NULL, will respect the setting from any previous calls to enableBookmarking(). See enableBookmarking() for more information on bookmarking your app.

uiPattern

A regular expression that will be applied to each GET request to determine whether the ui should be used to handle the request. Note that the entire request path must match the regular expression in order for the match to be considered successful.

...

arguments to pass to golem_opts. See '?golem::get_golem_options' for more details.

Value

No return value, called for side effects


72-hour acute salinity tolerance of macro-invertebrates grouped by family.

Description

72-hour acute salinity tolerance (LC50 values) of riverine macro-invertebrates grouped by taxonomic family.

Usage

salinity_family

Format

Salinity_order

A data frame with 108 rows and 3 columns:

left, right

Lower & higher bounds of the lethal concentration interval in mS/cm2^2.

group

Family of each tested specie.

Source

https://cdnsciencepub.com/doi/abs/10.1139/f06-080


72-hour acute salinity tolerance of macro-invertebrates grouped by order.

Description

72-hour acute salinity tolerance (LC50 values) of riverine macro-invertebrates grouped by taxonomic order.

Usage

salinity_order

Format

Salinity_order

A data frame with 108 rows and 3 columns:

left, right

Lower & higher bounds of the lethal concentration interval in mS/cm2^2.

group

Order of each tested specie.

Source

https://cdnsciencepub.com/doi/abs/10.1139/f06-080


Custom toggle switch input for shiny UI

Description

Custom toggle switch input for shiny UI

Usage

switchInput(id, aria_label, checked = TRUE)

Arguments

id

The input slot that will be used to access the value.

aria_label

An invisible label for screen readers.

checked

Whether to create the switch as ON.

Value

A toggle switch control that can be added to a UI definition.


Test the approximate equality of the quantiles from several bootstrap samples

Description

Test the approximate equality of the quantiles from several bootstrap samples

Usage

test_conv(bs, probs)

Arguments

bs

A list of bootdist or bootdistcens objects obtained from the same fit object.

probs

A numeric vector of probabilities with values in [0,1]

Value

A logical.