% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/namepref.R
\name{namepref}
\alias{namepref}
\title{Add variable name prefix (with substitution)}
\usage{
namepref(dataframe, pref_old, pref_new)
}
\arguments{
\item{dataframe}{A dataframe}

\item{pref_old}{Old prefix character that some or all variables in the dataframe have}

\item{pref_new}{New prefix character to replace the old one}
}
\value{
Returns dataframe with those variables renamed that start with the old prefix.
}
\description{
This function strips the old prefix from the variable names of the dataframe.
It then adds the new prefix where the old one was and changes the dataframe's names to the new ones.
}
\examples{
bla <- tibble::tibble(x_ar = 1:5, y_ar = 6:10)
blo <- namepref(bla, "x_", "z_")
names(bla)
names(blo)

}
