% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/swap.R
\name{swap}
\alias{swap}
\title{Swap Two Patterns Simultaneously}
\usage{
swap(x, pattern1, pattern2, ...)
}
\arguments{
\item{x}{A text variable.}

\item{pattern1}{Character string to be matched in the given character vector.
This will be replaced by \code{pattern2}.}

\item{pattern2}{Character string to be matched in the given character vector.
This will be replaced by \code{pattern1}.}

\item{\ldots}{ignored.}
}
\value{
Returns a vector with patterns 1 & 2 swapped.
}
\description{
Swap pattern x for pattern y and pattern y for pattern x in one fell swoop.
}
\examples{
x <- c("hash_abbreviation", "hash_contractions", "hash_grade", "key_emoticons", 
    "key_power", "key_sentiment", "key_sentiment_nrc", "key_strength", 
    "key_syllable", "key_valence_shifters")

x
swap(x, 'hash_', 'key_')
}
