getSSDplot: Species Sentivity Distribution (SSD) Plots

Description Usage Arguments Details Value Examples

View source: R/getSSDplot.R

Description

Generates plots of the proportion of species affected at different exposure levels in laboratory toxicity tests.

Usage

1
getSSDplot(Data, ResponseType, Taxa, Exposure)

Arguments

Data

species data set name

ResponseType

column containing endpoint

Taxa

column containing taxa names

Exposure

column containing Exposure amount

Details

https://www.epa.gov/caddis-vol4/ssd-plots

Value

An SSD plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Example 1
# Define parameters
myDF   <- data_SSD
myRT   <- "ResponseType"
myTaxa <- "Taxa"
myExp  <- "Exposure_mgperL"
# Run function
p1 <- getSSDplot(myDF, myRT, myTaxa, myExp)
print(p1)
# can save output to a file
## Not run: 
library(ggplot2)
fn_p1 <- file.path(getwd(), "Results", "SSD_example1.pdf")
ggsave(fn_p1, p1)

## End(Not run)

#~~~~~~~~~~~~~~~~~~~~~~~~~~

# Example 2
myDF   <- data_SSD_permethrin
myRT   <- "ResponseType"
myTaxa <- "Taxa"
myExp  <- "Exposure"
# Add missing column
myDF[,myRT] <- "LC50"
# Run function
p2 <- getSSDplot(myDF, myRT, myTaxa, myExp)
print(p2)
#' # can save output to a file
## Not run: 
fn_p2 <- file.path(getwd(), "Results", "SSD_example2.pdf")
ggplot2::ggsave(fn_p2, p2)

## End(Not run)

#~~~~~~~~~~~~~~~~~~~~~~~~~~

# Example 3 
# https://www.epa.gov/caddis-vol4/caddis-volume-4-data-analysis-download-software
# ssd_generator_v1.xlsm
myDF <- data_SSD_generator
myRT   <- "ResponseType"
myTaxa <- "Taxa"
myExp  <- "Exposure"
# Run function
p3 <- getSSDplot(myDF, myRT, myTaxa, myExp)
print(p3)
# 
# can save output to a file
## Not run: 
fn_p3 <- file.path(getwd(), "Results", "SSD_example3.pdf")
ggplot2::ggsave(fn_p3, p3)

## End(Not run)
 
#~~~~~~~~~~~~~~~~~~~~~~~~~~
 
# Example 2_mod 
# (same plot as #2 above)
library(ggplot2)
# create points
analyte <- c(0.05, 0.5, 5)
abund <- c(0, 1/3, 2/3)
taxon <- c("Baetis", "Cricotopus", "Simulium")
df.site <- data.frame(analyte, abund, taxon)
# add points to plot and add title (centered)
p2 + 
  geom_point(data=df.site, aes(x=analyte, y=abund), colour="blue", size = 2) + 
  geom_text(data=df.site, aes(x=analyte, y=abund, label=taxon)
                             , hjust="left", nudge_x=0.05, colour="blue") + 
  labs(title="Cluster SSD with site specific taxa") + theme(plot.title=element_text(hjust=0.5))
  

leppott/CASTfxn documentation built on Sept. 6, 2019, 11:04 p.m.