View source: R/SumStats.updated.R
SumStats.updated | R Documentation |
Generates daily stats (N, mean, min, max, range, std deviation) for the specified time period before a given date. Output is a multiple column CSV (Date and Parameter Name by statistic) and a report (HTML or DOCX) with plots. Input is the ouput file of the QC operation of ContDataQC().
SumStats.updated(
fun.myFile,
fun.myDir.import = getwd(),
fun.myParam.Name,
fun.myDateTime.Name = "Date.Time",
fun.myDateTime.Format = NA,
fun.myThreshold = NA,
fun.myConfig = ""
)
fun.myFile |
Filename (no directory) of data file. Must be CSV file. |
fun.myDir.import |
Directory for import data. Default is current working directory. |
fun.myParam.Name |
Column name in myFile to perform summary statistics. One or two parameters can be specified. |
fun.myDateTime.Name |
Column name in myFile for date time. Default = "Date.Time". |
fun.myDateTime.Format |
Format of DateTime field. Default = %Y-%m-%d %H:%M:%S. |
fun.myThreshold |
Value to draw line on plot. For example, a regulatory limit. Default = NA |
fun.myConfig |
Configuration file to use for this data analysis. The default is always loaded first so only "new" values need to be included. This is the easiest way to control date and time formats. |
fun.myDir.export |
Directory for export data. Default is current working directory. |
The input is output file of the QC operation in ContDataQC(). That is, a file with Date.Time, and parameters (matching formats in config.R). One or two parameters can be analyzed at a time. Requires doBy library for the daily statistics summary
Returns a data frame
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Save example files from Package to use for example
## This step not needed for users working on their own files
df.x <- DATA_period_test2_Aw_20130101_20141231
write.csv(df.x,"DATA_period_test2_Aw_20130101_20141231.csv")
myFile <- "config.ExcludeFailsFalse.R"
file.copy(file.path(path.package("ContDataQC"), "extdata", myFile)
, file.path(getwd(), myFile))
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Load File to use for PeriodStats
myDir <- tempdir()
myFile <- "DATA_period_test2_AW_20130101_20141231.csv"
df.x <- read.csv(file.path(myDir, myFile))
# function inputs
myFile <- "DATA_period_test2_Aw_20130101_20141231.csv"
myDir.import <- tempdir()
myParam.Name <- "Water.Temp.C"
myDateTime.Name <- "Date.Time"
myDateTime.Format <- "%Y-%m-%d %H:%M:%S"
myThreshold <- 20
myConfig <- ""
# Custom Config
myConfig.Fail.Include <- "config.ExcludeFailsFalse.R"
# Run Function
## Example 1. default report format (html)
SumStats.updated(myFile
, myDir.import
, myParam.Name
, myDateTime.Name
, myDateTime.Format
, myThreshold
, myConfig)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.