# Test new Site Summary Notebook
# Erik.Leppo@tetratech.com
# 2022-05-20
#
# Use fun.Report.File() to launch
# \inst\rmd\Report_SiteSummary.rmd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Packages
library(ContDataQC)
# Copy Example file to Temp Directory
myFile <- "DATA_test2_Aw_20130101_20141231.csv"
file.copy(file.path(path.package("ContDataQC"), "extdata", myFile)
, file.path(tempdir(), myFile))
# Open Directory
shell.exec(tempdir())
# Create Notebook
# fun.Report.File(
# fun.myFile = myFile,
# fun.myDir.import = tempdir(),
# fun.myDir.export = tempdir(),
# fun.myFile.Prefix = "SUMMARY",
# fun.myReport.format = "HTML",
# fun.myReport.Dir = path.package("ContDataQC"), "extdata", "rmd")
# )
fun.myFile = myFile
fun.myDir.import = tempdir()
fun.myDir.export = tempdir()
fun.myFile.Prefix = "SUMMARY"
fun.myReport.format = "HTML"
# fun.myReport.Dir = file.path(path.package("ContDataQC"), "rmd")
fun.myReport.Dir = file.path("inst", "rmd")
myRMD <- "Report_SiteSummary.rmd"
# Config file
source(file.path(path.package("ContDataQC"), "extdata", "config.ORIG.R"))
data.import <- read.csv(file.path(tempdir(), myFile))
# # Alternative
# library(daiquiri)
# myCols <- c("SiteID"
# , "Date.Time"
# , "Water.Temp.C"
# , "Air.Temp.C"
# , "Water.P.psi"
# , "Air.BP.psi"
# , "Sensor.Depth.ft")
# fts <- fieldtypes(SiteID = ft_uniqueidentifier()
# , Date.Time = ft_timepoint()
# , Water.Temp.C = ft_numeric()
# , Air.Temp.C = ft_numeric()
# , Water.P.psi = ft_numeric()
# , Air.BP.psi = ft_numeric()
# , Sensor.Depth.ft = ft_numeric())
# daiqobj <- create_report(
# data.import[, myCols]
# , fieldtypes = fts
# , dataset_shortdesc = paste0("example dataset, ContDataQ, ", myFile)
# )
# RMD needs
strFile <- myFile
strFile.SiteID <- "testSiteID"
# strFile.DataType <- "DATA" # not needed, comment out
fun.myData.DateRange.Start <- "20130101"
fun.myData.DateRange.End <- "20141231"
myName.Date <- "Date"
#
strFile.RMD <- file.path(fun.myReport.Dir, myRMD)
strFile.RMD.format <- fun.myReport.format
strFile.out <- paste0("test.", fun.myReport.format)
# Render RMD
rmarkdown::render(strFile.RMD
, output_format = strFile.RMD.format
, output_file = strFile.out
, output_dir = fun.myDir.export
, quiet = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.