dr_factor: Creating correction factors

Description Usage Arguments Details Value See Also Examples

View source: R/dr_factor.R

Description

A wrapper around dplyr::mutate() that creates a correction factor for each observation.

Usage

1
2
dr_factor(.data, corrFactor, dateVar, timeVar, tz = NULL,
    format = c("MDY", "YMD"), keepDateTime = TRUE)

Arguments

.data

A tbl

corrFactor

New variable name for correction factor data

dateVar

Name of variable containing date data

timeVar

Name of variable containing time data

tz

String name of timezone, defaults to system's timezone

format

Either "MDY" or "YMD" for dateVar - deprecated as of driftR v1.1

keepDateTime

A logical statement to keep an intermediate dateTime variable

Details

Correction factors are calculated based on the time of the observation and the total amount of time that the instrument had been deployed. They are used in the equations for both the one-point and two-point drift corrections.

Value

An object of the same class as .data with the new correction factor variable added to the other data in .data as well as a dateTime variable if keepDateTime = TRUE.

See Also

dr_correctOne for correction factor creation, dr_correctTwo for the two-point drift correction

Examples

1
2
3
4
5
6
7
8
9
testData <- data.frame(
   Date = c("9/18/2015", "9/18/2015", "9/18/2015", "9/18/2015", "9/18/2015", "9/18/2015"),
   Time = c("12:10:49", "12:15:50", "12:20:51", "12:25:51", "12:30:51", "12:35:51"),
   Temp = c(14.76, 14.64, 14.57, 14.51, 14.50, 14.63),
   SpCond = c(0.754, 0.750, 0.750, 0.749, 0.749, 0.749),
   stringsAsFactors = FALSE
 )

dr_factor(testData, corrFactor = corrFac, dateVar = Date, timeVar = Time, keepDateTime = TRUE)

driftR documentation built on May 1, 2019, 8:43 p.m.