Commit 5863a85a authored by Chris Holbrook's avatar Chris Holbrook

allow real_sensor_values return data.table or tibble; match input

parent 2fa7282c
......@@ -67,8 +67,8 @@
#' \code{tag_specs} and is the correct record for the corresponding tags in
#' \code{det}.
#'
#' @return The input data frame with the following columns added (see column
#' descriptions above):
#' @return The input data frame, data.table, or tibble with the following
#' columns added (see column descriptions above):
#'
#' \itemize{
#' \item sensor_range
......@@ -138,5 +138,12 @@ real_sensor_values <- function(det, tag_specs){
#calculate real values
dtc[ , sensor_value_real := sensor_intercept + (sensor_value * sensor_slope)]
#return data.table if input class data.table
if(inherits(det, "data.table")) return(dtc)
#return tibble if input class tibble
if(inherits(det, "tbl")) return(tibble::as_tibble(dtc))
return(as.data.frame(dtc))
}
......@@ -58,8 +58,8 @@ data with the following columns:
}}
}
\value{
The input data frame with the following columns added (see column
descriptions above):
The input data frame, data.table, or tibble with the following
columns added (see column descriptions above):
\itemize{
\item sensor_range
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment