forked from leppott/ContDataQC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
113 lines (87 loc) · 4.18 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
title: "README-ContDataQC"
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE
, comment = "#>"
, fig.path = "README-"
)
```
```{r, echo = FALSE}
cat(paste0("Last Update: ",Sys.time()))
```
# ContDataQC
Quality control checks on continuous data. Example data is from a HOBO data logger with 30 minute intervals.
Installation
-----------------
```{r, eval=FALSE}
# Installing just this library (should get all dependancies)
library(devtools)
install_github("leppott/ContDataQC")
```
If dependant libraries do not load you can install them separately.
```{r, eval=FALSE}
# Choose a CRAN mirror (dowload site) first (can change number)
chooseCRANmirror(ind=21)
# libraries to be installed
data.packages = c(
"devtools" # install helper for non CRAN libraries
,"installr" # install helper
,"digest" # caused error in R v3.2.3 without it
,"dataRetrieval" # loads USGS data into R
,"knitr" # create documents in other formats (e.g., PDF or Word)
,"doBy" # summary stats
,"zoo" # z's ordered observations, use for rolling sd calc
,"htmltools" # needed for knitr and doesn't always install properly with Pandoc
,"rmarkdown" # needed for knitr and doesn't always install properly with Pandoc
,"htmltools" # a dependency that is sometimes missed.
,"evaluate" # a dependency that is sometimes missed.
,"highr" # a dependency that is sometimes missed.
,"rmarkdown" # a dependency that is sometimes missed.
)
lapply(data.packages,function(x) install.packages(x))
```
Additionally Pandoc is required for creating the reports and needs to be installed separately.
```{r, eval=FALSE}
## pandoc
require(installr)
install.pandoc()
```
Purpose
--------------
Built for a project for USEPA for Regional Monitoring Networks (RMN).
Takes as input continuous data from data loggers and QCs it by checking for gross differences, spikes, rate of change differences, flat line (consecutive same values), and data gaps. The `ContDataQC` package provides a organized workflow to QC, aggregate, partition, and generate summary stats.
The code was presented at the following workshops. And further developed under contract to USEPA.
* Oct 2015, SWPBPA (Region 4 regional biologist meeting, Myrtle Beach, SC).
* Mar 2016, AMAAB (Region 3 regional biologist meeting, Cacapon, WV).
* Apr 2016, NWQMC (National Water Monitoring Council Conference, Tampa, FL).
Functions were developed to help data generators handle data from continuous data sensors (e.g., HOBO data loggers).
From a single function, ContDataQC(), can QC, aggregate, or calculate summary stats on data. `ContDataQC` Uses the USGS `dataRetrieval` library to get USGS gage data. Reports are generated in Word (through the use of knitr and Pandoc).
Usage
------------
Everytime R is launched the `ContDataQC` package needs to be loaded.
```{r, eval=FALSE}
# load library and dependant libraries
require("ContDataQC")
```
The default working directory is based on how R was installed but is typically the user's 'MyDocuments' folder. You can change it through the menu bar in R (File - Change dir) or RStudio (Session - Set Working Directory). You can also change it from the command line.
```{r, eval=FALSE}
# if specify directory use "/" not "\" (as used in Windows) and leave off final "/" (example below).
#myDir.BASE <- "C:/Users/Erik.Leppo/Documents/NCEA_DataInfrastructure/Erik"
myDir.BASE <- getwd()
setwd(myDir.BASE)
```
Help
------------
Every function has a help file with a working example. There is also a vignette with descriptions and examples of all functions in the `ContDataQC` library.
```{r, eval=FALSE}
# To get help on a function
# library(ContDataQC) # the library must be loaded before accessing help
?ContDataQC
```
```{r, eval=FALSE}
vignette("ContDataQC_Vignette",package="ContDataQC")
```