R/licorFinder.R

Defines functions licorFinder

Documented in licorFinder

#' Pick the first column that matches what we want
#'
#' Given a dataframe and a column name, find the first column index that contains the chosen name.
#' @param df A dataframe.
#' @param colChoose The column we want to find
#' @name licorFinder

licorFinder <- function(df,colChoose){
  found <- dplyr::first(which(grepl(pattern = colChoose,x = colnames(df))==TRUE))
  if(is.na(found)){
    cat("The chosen column name was not found in df.\n")
    return(NA)
  }
  else return(found)
}
poales/readLicorData documentation built on July 27, 2022, 10:21 p.m.