Skip to content

Commit b6cbb6f

Browse files
author
Jordan S Read
committed
adding doc and optional args
1 parent 797cebb commit b6cbb6f

File tree

2 files changed

+65
-3
lines changed

2 files changed

+65
-3
lines changed

R/clean.data.R

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1+
#'@title cleans sensor data with user-specified routines
2+
#'@description
3+
#'cleans sensor data according to details within the user-specified config (*yml) file \cr
4+
#'
5+
#'@param deploy a string for the *.yml file name
6+
#'@param folder a string which specifies the folder of the *.yml file
7+
#'@param plot.diagnostic a boolean for creating a diagnostic plot
8+
#'@param write.file a boolean for creating a timeseries file output
9+
#'@return An optional plot and optional file output handle
10+
#'@keywords methods
11+
#'@author
12+
#'Jordan S. Read
13+
#'@examples
14+
#'\dontrun{
15+
#'clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=FALSE)
16+
#'clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=TRUE,write.file=TRUE)
17+
#'}
118
#'@export
2-
clean.data <- function(deploy='pellerin',folder='../examples/'){
19+
clean.data <- function(deploy='pellerin',folder='../examples/',plot.diagnostic=TRUE, write.file= FALSE){
320
#is an example wrapper for sensorQC calls
421

522
#
@@ -23,8 +40,19 @@ clean.data <- function(deploy='pellerin',folder='../examples/'){
2340
old.inst.flags <- build_flags(data.in=windowed.data,sqc=simple.sqc$outlier_removal,verbose=F)
2441
old.sensor <- block_stats(windowed.data=windowed.data,old.inst.flags)
2542

26-
plot_summary(inst.data=windowed.data,inst.flags,block.data=sensor.stats,block.flags,
27-
compare.data=old.sensor,sqc=cnfg)
43+
if (plot.diagnostic){
44+
plot_summary(inst.data=windowed.data,inst.flags,block.data=sensor.stats,block.flags,
45+
compare.data=old.sensor,sqc=cnfg)
46+
}
47+
48+
if (write.file){
49+
output = paste0(folder,deploy,"_sqc_out.tsv")
50+
flat.block <- flatten_flags(block.flags)
51+
write.out <- sensor.stats[!flat.block, ]
52+
write.table(write.out,file=output,col.names=TRUE, quote=FALSE, row.names=FALSE, sep="\t")
53+
}
54+
55+
2856

2957

3058

man/clean.data.Rd

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
% Generated by roxygen2 (4.0.1): do not edit by hand
2+
\name{clean.data}
3+
\alias{clean.data}
4+
\title{cleans sensor data with user-specified routines}
5+
\usage{
6+
clean.data(deploy = "pellerin", folder = "../examples/",
7+
plot.diagnostic = TRUE, write.file = FALSE)
8+
}
9+
\arguments{
10+
\item{deploy}{a string for the *.yml file name}
11+
12+
\item{folder}{a string which specifies the folder of the *.yml file}
13+
14+
\item{plot.diagnostic}{a boolean for creating a diagnostic plot}
15+
16+
\item{write.file}{a boolean for creating a timeseries file output}
17+
}
18+
\value{
19+
An optional plot and optional file output handle
20+
}
21+
\description{
22+
cleans sensor data according to details within the user-specified config (*yml) file \cr
23+
}
24+
\examples{
25+
\dontrun{
26+
clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=FALSE)
27+
clean.data(deploy='pellerin',folder='/[User]/Desktop/Science Projects/sensorQC/',plot.diagnostic=TRUE,write.file=TRUE)
28+
}
29+
}
30+
\author{
31+
Jordan S. Read
32+
}
33+
\keyword{methods}
34+

0 commit comments

Comments
 (0)