R/residence-time_units.R

Defines functions get_residence_units

Documented in get_residence_units

#' get_residence_units
#' @param f_name character file name of raw data
#' @importFrom utils read.csv
#' @export
#' @examples \dontrun{
#' f_name <- "474/100.csv"
#' get_residence_units(f_name)
#' }

get_residence_units <- function(f_name){
	dt <- read.csv(f_name, stringsAsFactors = FALSE)

	if(length(grep("year", tolower(dt))) > 0){
		return("years")
	}

	if(length(grep("day", tolower(dt))) > 0){
		return("days")
	}

	NA
}
jsta/nesR documentation built on Oct. 16, 2023, 12:25 a.m.