% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/collapse.R
\name{fct_collapse}
\alias{fct_collapse}
\title{Collapse factor levels into manually defined groups}
\usage{
fct_collapse(.f, ..., other_level = NULL, group_other = "DEPRECATED")
}
\arguments{
\item{.f}{A factor (or character vector).}

\item{...}{<\code{\link[rlang:dyn-dots]{dynamic-dots}}> A series of named character vectors. The levels in
each vector will be replaced with the name.}

\item{other_level}{Value of level used for "other" values. Always
placed at end of levels.}

\item{group_other}{Deprecated. Replace all levels not named in \code{...} with "Other"?}
}
\description{
Collapse factor levels into manually defined groups
}
\examples{
fct_count(gss_cat$partyid)

partyid2 <- fct_collapse(gss_cat$partyid,
  missing = c("No answer", "Don't know"),
  other = "Other party",
  rep = c("Strong republican", "Not str republican"),
  ind = c("Ind,near rep", "Independent", "Ind,near dem"),
  dem = c("Not str democrat", "Strong democrat")
)
fct_count(partyid2)
}
