FreesearchR/man/factor_new_levels_labels.Rd

35 lines
837 B
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update-factor-ext.R
\name{factor_new_levels_labels}
\alias{factor_new_levels_labels}
\title{Simple function to apply new levels and/or labels to factor}
\usage{
factor_new_levels_labels(
data,
variable,
new_variable = TRUE,
new_levels = NULL,
new_labels = NULL,
ignore = "New label"
)
}
\arguments{
\item{variable}{factor variable}
\item{ignore}{character string to ignore in new labels}
\item{new_level}{new levels, same length as original}
\item{new_label}{new labels, same length as original}
}
\value{
factor
}
\description{
Simple function to apply new levels and/or labels to factor
}
\examples{
data_n <- mtcars
data_n$cyl <- factor(data_n$cyl)
factor_new_levels_labels(data_n, "cyl", new_labels = c("four", "New label", "New label"))
}