Newer
Older
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/FarmDynR.R
\name{replace_first_match_col}
\alias{replace_first_match_col}
\title{`replace_first_match_col()` replaces the name of the column in `first_match_col()` with what the user inputs}
\usage{
replace_first_match_col(x, pattern, how = c("all", "any"), replace_with)
}
\arguments{
\item{x}{A dataframe}
\item{pattern}{A pattern to match}
\item{how}{How to match the pattern (all or any)}
\item{replace_with}{The name to replace the column name with}
}
\value{
dataframe with the replaced column name
}
\description{
`replace_first_match_col()` replaces the name of the column in `first_match_col()` with what the user inputs
}
\examples{
data <- data.frame(a = c("a", "b", "c"), b = c("a", " ", "c"), c = c("a", "b", "1"))
replace_first_match_col(data, "\\\\D", "all", "new")
replace_first_match_col(data, "\\\\d", "any", "new")
}