dr_factor: Creating correction factors

View source: R/dr_factor.R

dr_factorR Documentation

Creating correction factors

Description

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

Usage

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

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)


shaughnessyar/driftR documentation built on July 25, 2022, 8:32 a.m.