getStressorList: Stressor List

Description Usage Arguments Details Value Examples

View source: R/getStressorList.R

Description

Get stressor list.

Usage

1
2
3
4
getStressorList(TargetSiteID, site.Clusters, chem.info, cluster.chem,
  cluster.samps, ref.sites, site.chem, probsHigh, probsLow,
  biocomm = "bmi", dir_results = file.path(getwd(), "Results"),
  dir_sub = "CandidateCauses")

Arguments

TargetSiteID

Site ID

site.Clusters

Clusters

chem.info

chem information

cluster.chem

chem data cluster.

cluster.samps

sample cluster.

ref.sites

reference sites

site.chem

Chem sites

probsHigh

probabilities, high

probsLow

probabilities, low

biocomm

Biological community; algae or BMI. Default = "BMI".

dir_results

Directory to save plots. Default = working directory and Results.

dir_sub

Subdirectory for outputs from this function. Default = "SiteInfo"

Details

Box plots of each stressor, grouped by category.

Required objects: all specified as inputs.

chem.info need to include DirIncStress. Valid values are 'inc' or 'dec'.

Value

A jpeg in the "Results" subdirectory of the working directory with box plots. Also returns a list of stressors; stressors and site.stressor.pctrank.

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
74
75
76
77
78
79
80
81
82
83
84
85
86
TargetSiteID <- "SRCKN001.61"
dir_results <- file.path(getwd(), "Results")

# Data getSiteInfo
# data, example included with package
data.Stations.Info <- data_Sites        # need for getSiteInfo and getChemDataSubsets
data.SampSummary   <- data_SampSummary
data.303d.ComID    <- data_303d
data.bmi.metrics   <- data_BMIMetrics
data.algae.metrics <- data_AlgMetrics
data.mod           <- data_ReachMod

# Cluster based on elevation category  # need for getSiteInfo and getChemDataSubsets
elev_cat <- toupper(data.Stations.Info[data.Stations.Info[,"StationID_Master"]==TargetSiteID
                    , "ElevCategory"])
if(elev_cat=="HI"){
   data.cluster <- data_Cluster_Hi
} else if(elev_cat=="LO") {
   data.cluster <- data_Cluster_Lo
}

# Map data
# San Diego
#flowline <- rgdal::readOGR(dsn = "data_gis/NHDv2_Flowline_Ecoreg85", layer = "NHDv2_eco85_Project")
#outline <- rgdal::readOGR(dsn = "data_gis/Eco85", layer = "Ecoregion85")
# AZ
map_flowline  <- data_GIS_Flow_HI
map_flowline2 <- data_GIS_Flow_LO
if(elev_cat=="HI"){
   map_flowline <- data_GIS_Flow_HI
} else if(elev_cat=="LO") {
   map_flowline <- data_GIS_Flow_LO
}
map_outline   <- data_GIS_AZ_Outline
# Project site data to USGS Albers Equal Area
usgs.aea <- "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23
              +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83
              +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0"
# projection for outline
my.aea <- "+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 
           +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0"
map_proj <- my.aea
#
dir_sub <- "SiteInfo"

# Run getSiteInfo
list.SiteSummary <- getSiteInfo(TargetSiteID, dir_results, data.Stations.Info
                                , data.SampSummary, data.303d.ComID
                                , data.bmi.metrics, data.algae.metrics
                                , data.cluster, data.mod
                                , map_proj, map_outline, map_flowline
                                , dir_sub=dir_sub)

# Data getChemDataSubsets
# data import, example 
# data.chem.raw <- read.delim(paste(myDir.Data,"data.chem.raw.tab",sep=""),na.strings = c(""," "))
# data.chem.info <- read.delim(paste(myDir.Data,"data.chem.info.tab",sep=""))
# data, example included with package
site.COMID <- list.SiteSummary$COMID
site.Clusters <- list.SiteSummary$ClustIDs
data.chem.raw <- data_Chem
data.chem.info <- data_ChemInfo

# Run getChemDataSubsets
list.data <- getChemDataSubsets(TargetSiteID, comid=site.COMID, cluster=site.Clusters
                                , data.cluster=data.cluster, data.Stations.Info=data.Stations.Info
                                , data.chem.raw=data.chem.raw, data.chem.info=data.chem.info)

# datasets getStressorList
chem.info <- list.data$chem.info
cluster.chem <- list.data$cluster.chem
cluster.samps <- list.data$cluster.samps
ref.sites <- list.data$ref.sites
site.chem <- list.data$site.chem
dir_sub <- "CandidateCauses"

# set cutoff for possible stressor identification
probsLow <- 0.10
probsHigh <- 0.90 
biocomm <- "bmi"

# Run getStressorList
list.stressors <- getStressorList(TargetSiteID, site.Clusters, chem.info, cluster.chem
                                 , cluster.samps, ref.sites, site.chem
                                 , probsHigh, probsLow, biocomm, dir_results
                                 , dir_sub)

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