dr_drop() includes three approaches for removing observations from the monitoring period. Observations may be removed by specifying the number to remove from the head and/or the tail of the observation. They may also be removed by specifying one or two timepoints in the data where problematic observations begin, end, or fall between. Finally observations may be removed based on a problematic sensor value or range of values using an expression.

dr_drop(.data, head = NULL, tail = NULL, dateVar = NULL, timeVar = NULL, from = NULL,
    to = NULL, tz = NULL, exp)

Arguments

.data

A tbl

head

An integer >= 1 specifying the number of rows to be removed from the top of .data (or NULL)

tail

An integer >= 1 specifying the number of rows to be removed from the bottom of .data (or NULL)

dateVar

Name of variable containing date data

timeVar

Name of variable containing time data

from

Beginning date and (optionally) time to remove observations

to

End date and (optionally) time to remove observations

tz

String name of timezone, defaults to system's timezone

exp

Unquoted expression

Value

An object of the same class as .data with specified observations removed.

Details

When taking the instrument out of the water, there are often several observations that pass before the run can be downloaded. Additionally, once the instrument is in the water, it often takes about 30 minutes for the sensors to equilibrate. This function allows you to drop observations from the bottom and top of the data set for each of those issues respectively. This function also provides approaches for removing observations from the middle of the data set.

Examples

testData <- data.frame( Date = c("9/18/2015", "9/18/2015", "9/18/2015", "9/18/2015", "9/19/2015", "9/21/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_drop(testData, head = 2)
#> Drop approach - completed using the head and/or tail arguments.
#> Date Time Temp SpCond #> 1 9/18/2015 12:20:51 14.57 0.750 #> 2 9/18/2015 12:25:51 14.51 0.749 #> 3 9/19/2015 12:30:51 14.50 0.749 #> 4 9/21/2015 12:35:51 14.63 0.749
dr_drop(testData, tail = 1)
#> Drop approach - completed using the head and/or tail arguments.
#> Date Time Temp SpCond #> 1 9/18/2015 12:10:49 14.76 0.754 #> 2 9/18/2015 12:15:50 14.64 0.750 #> 3 9/18/2015 12:20:51 14.57 0.750 #> 4 9/18/2015 12:25:51 14.51 0.749 #> 5 9/19/2015 12:30:51 14.50 0.749
dr_drop(testData, head = 2, tail = 1)
#> Drop approach - completed using the head and/or tail arguments.
#> Date Time Temp SpCond #> 1 9/18/2015 12:20:51 14.57 0.750 #> 2 9/18/2015 12:25:51 14.51 0.749 #> 3 9/19/2015 12:30:51 14.50 0.749
dr_drop(testData, dateVar = Date, timeVar = Time, from = "9/19/2015")
#> Drop approach - completed using the date/time arguments.
#> Date Time Temp SpCond #> 1 9/18/2015 12:10:49 14.76 0.754 #> 2 9/18/2015 12:15:50 14.64 0.750 #> 3 9/18/2015 12:20:51 14.57 0.750 #> 4 9/18/2015 12:25:51 14.51 0.749
dr_drop(testData, dateVar = Date, timeVar = Time, from = "9/18/2015 12:25:51")
#> Drop approach - completed using the date/time arguments.
#> Date Time Temp SpCond #> 1 9/18/2015 12:10:49 14.76 0.754 #> 2 9/18/2015 12:15:50 14.64 0.750 #> 3 9/18/2015 12:20:51 14.57 0.750
dr_drop(testData, dateVar = Date, timeVar = Time, to = "9/19/2015")
#> Drop approach - completed using the date/time arguments.
#> Date Time Temp SpCond #> 1 9/19/2015 12:30:51 14.50 0.749 #> 2 9/21/2015 12:35:51 14.63 0.749
dr_drop(testData, dateVar = Date, timeVar = Time, to = "9/18/2015 12:25:51")
#> Drop approach - completed using the date/time arguments.
#> Date Time Temp SpCond #> 1 9/18/2015 12:25:51 14.51 0.749 #> 2 9/19/2015 12:30:51 14.50 0.749 #> 3 9/21/2015 12:35:51 14.63 0.749
dr_drop(testData, dateVar = Date, timeVar = Time, from = "9/18/2015 12:25:51", to = "9/19/2015 12:30:51")
#> Drop approach - completed using the date/time arguments.
#> Date Time Temp SpCond #> 1 9/18/2015 12:10:49 14.76 0.754 #> 2 9/18/2015 12:15:50 14.64 0.750 #> 3 9/18/2015 12:20:51 14.57 0.750 #> 4 9/19/2015 12:30:51 14.50 0.749 #> 5 9/21/2015 12:35:51 14.63 0.749
dr_drop(testData, dateVar = Date, timeVar = Time, from = "9/18/2015 12:00", to = "9/19/2015 13:00")
#> Drop approach - completed using the date/time arguments.
#> Date Time Temp SpCond #> 1 9/21/2015 12:35:51 14.63 0.749
dr_drop(testData, exp = Temp > 14.7)
#> Drop approach - completed using the expression.
#> Date Time Temp SpCond #> 1 9/18/2015 12:15:50 14.64 0.750 #> 2 9/18/2015 12:20:51 14.57 0.750 #> 3 9/18/2015 12:25:51 14.51 0.749 #> 4 9/19/2015 12:30:51 14.50 0.749 #> 5 9/21/2015 12:35:51 14.63 0.749