From b6cbb6fd1e2a9364458e3a689f85ffa97071eae0 Mon Sep 17 00:00:00 2001 From: Jordan S Read Date: Thu, 10 Jul 2014 10:13:10 -0500 Subject: [PATCH] adding doc and optional args --- R/clean.data.R | 34 +++++++++++++++++++++++++++++++--- man/clean.data.Rd | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 man/clean.data.Rd diff --git a/R/clean.data.R b/R/clean.data.R index b1de709..ff21812 100644 --- a/R/clean.data.R +++ b/R/clean.data.R @@ -1,5 +1,22 @@ +#'@title cleans sensor data with user-specified routines +#'@description +#'cleans sensor data according to details within the user-specified config (*yml) file \cr +#' +#'@param deploy a string for the *.yml file name +#'@param folder a string which specifies the folder of the *.yml file +#'@param plot.diagnostic a boolean for creating a diagnostic plot +#'@param write.file a boolean for creating a timeseries file output +#'@return An optional plot and optional file output handle +#'@keywords methods +#'@author +#'Jordan S. Read +#'@examples +#'\dontrun{ +#'clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=FALSE) +#'clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=TRUE,write.file=TRUE) +#'} #'@export -clean.data <- function(deploy='pellerin',folder='../examples/'){ +clean.data <- function(deploy='pellerin',folder='../examples/',plot.diagnostic=TRUE, write.file= FALSE){ #is an example wrapper for sensorQC calls # @@ -23,8 +40,19 @@ clean.data <- function(deploy='pellerin',folder='../examples/'){ old.inst.flags <- build_flags(data.in=windowed.data,sqc=simple.sqc$outlier_removal,verbose=F) old.sensor <- block_stats(windowed.data=windowed.data,old.inst.flags) - plot_summary(inst.data=windowed.data,inst.flags,block.data=sensor.stats,block.flags, - compare.data=old.sensor,sqc=cnfg) + if (plot.diagnostic){ + plot_summary(inst.data=windowed.data,inst.flags,block.data=sensor.stats,block.flags, + compare.data=old.sensor,sqc=cnfg) + } + + if (write.file){ + output = paste0(folder,deploy,"_sqc_out.tsv") + flat.block <- flatten_flags(block.flags) + write.out <- sensor.stats[!flat.block, ] + write.table(write.out,file=output,col.names=TRUE, quote=FALSE, row.names=FALSE, sep="\t") + } + + diff --git a/man/clean.data.Rd b/man/clean.data.Rd new file mode 100644 index 0000000..3655fbd --- /dev/null +++ b/man/clean.data.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2 (4.0.1): do not edit by hand +\name{clean.data} +\alias{clean.data} +\title{cleans sensor data with user-specified routines} +\usage{ +clean.data(deploy = "pellerin", folder = "../examples/", + plot.diagnostic = TRUE, write.file = FALSE) +} +\arguments{ +\item{deploy}{a string for the *.yml file name} + +\item{folder}{a string which specifies the folder of the *.yml file} + +\item{plot.diagnostic}{a boolean for creating a diagnostic plot} + +\item{write.file}{a boolean for creating a timeseries file output} +} +\value{ +An optional plot and optional file output handle +} +\description{ +cleans sensor data according to details within the user-specified config (*yml) file \cr +} +\examples{ +\dontrun{ +clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=FALSE) +clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=TRUE,write.file=TRUE) +} +} +\author{ +Jordan S. Read +} +\keyword{methods} +