Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

replace_symbol

Replace Symbols With Word Equivalents


Description

This function replaces symbols with word equivalents (e.g., @ becomes "at".

Usage

replace_symbol(x, dollar = TRUE, percent = TRUE, pound = TRUE,
  at = TRUE, and = TRUE, with = TRUE, ...)

Arguments

x

A character vector.

dollar

logical. If TRUE replaces dollar sign ($) with "dollar".

percent

logical. If TRUE replaces percent sign (%) with "percent".

pound

logical. If TRUE replaces pound sign (#) with "number".

at

logical. If TRUE replaces at sign (@) with "at".

and

logical. If TRUE replaces and sign (&) with "and".

with

logical. If TRUE replaces with sign (w/) with "with".

...

ignored.

Value

Returns a character vector with symbols replaced..

Examples

x <- c("I am @ Jon's & Jim's w/ Marry", 
    "I owe $41 for food", 
    "two is 10% of a #"
)
replace_symbol(x)

textclean

Text Cleaning Tools

v0.9.3
GPL-2
Authors
Tyler Rinker [aut, cre], ctwheels StackOverflow [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.