knitr::opts_chunk$set(collapse = TRUE, comment = "#>", message = F, warning = F, fig.align = 'center')

The code below can be used to create and save the different matrix graphics for reporting purposes. A couple things to note when using this code:

# setup -------------------------------------------------------------------

# # install peptools, only do if the package is updated
# install.packages('remotes')
# remotes::install_github('tbep-tech/peptools')
library(peptools)

# update data to most recent ----------------------------------------------

# wq data, replace path with manually downloaded file
path <- system.file("extdata", "currentdata.xlsx", package="peptools")
rawdat <- read_pepwq(path)

# do data, takes a few minutes and make sure the date in endDate is updated
dodat <- read_pepdo(
  site = c("01304562", "01304200", "01304650"),
  nms = c("Peconic River", "Orient Harbor", "Shelter Island"),
  startDate = "2013-01-01",
  endDate = "2023-12-31"
)

# pathogen data
entdat <- read_pepent()

# secchi matrix -----------------------------------------------------------

p <- show_wqmatrixpep(rawdat, param = 'sd', txtsz = 3, alpha = 0.5) 

png('~/Desktop/sdmatrix.png', height = 7, width = 3, res = 300, units = 'in')
print(p)
dev.off()

# chl matrix --------------------------------------------------------------

p <- show_wqmatrixpep(rawdat, param = 'chl', txtsz = 3, alpha = 0.5) 

png('~/Desktop/chlmatrix.png', height = 7, width = 3, res = 300, units = 'in')
print(p)
dev.off()

# wq matrix ---------------------------------------------------------------

p <- show_matrixpep(rawdat, txtsz = 3) 

png('~/Desktop/wqmatrix.png', height = 7, width = 3, res = 300, units = 'in')
print(p)
dev.off()

# do matrix ---------------------------------------------------------------

p1 <- show_domatrix(dodat, site = 'Peconic River', thr = 4.8, txtsz = 3) 
p2 <- show_domatrix(dodat, site = 'Orient Harbor', thr = 4.8, txtsz = 3) 
p3 <- show_domatrix(dodat, site = 'Shelter Island', thr = 4.8, txtsz = 3) 

png('~/Desktop/domatrix1.png', height = 3, width = 5, res = 300, units = 'in')
print(p1)
dev.off()

png('~/Desktop/domatrix2.png', height = 3, width = 5, res = 300, units = 'in')
print(p2)
dev.off()

png('~/Desktop/domatrix3.png', height = 3, width = 5, res = 300, units = 'in')
print(p3)
dev.off()

# pathogen matrix ---------------------------------------------------------

p <- show_entmatrix(entdat, thr = 104, txtsz = 2) 

png('~/Desktop/entmatrix.png', height = 6, width = 7, res = 300, units = 'in')
print(p)
dev.off()


tbep-tech/peptools documentation built on March 13, 2024, 4:22 p.m.