replace_html: Replace HTML Markup

Description Usage Arguments Details Value Examples

View source: R/replace_html.R

Description

Replaces HTML markup. The angle braces are removed and the HTML symbol markup is replaced with equivalent symbols.

Usage

1

Arguments

x

The text variable.

symbol

logical. If codeTRUE the symbols are retained with appropriate replacements. If FALSE they are removed.

...

Ignored.

Details

Replacements for symbols are as follows:

html symbol
© (c)
® (r)
™ tm
“ "
” "
‘ '
’ '
• -
· -
⋅ []
– -
— -
¢ cents
£ pounds
€ euro
≠ !=
½ half
¼ quarter
¾ three fourths
° degrees
&larr; <-
&rarr; ->
&hellip; ...
&nbsp;
&lt; <
&gt; >
&laquo; <<
&raquo; >>
&amp; &
&quot; "
&apos; '
&yen; yen

Value

Returns a vector with HTML markup replaced.

Examples

1
2
3
4
5
6
7
8
x <- c(
    "<bold>Random</bold> text with symbols: &nbsp; &lt; &gt; &amp; &quot; &apos;",
    "<p>More text</p> &cent; &pound; &yen; &euro; &copy; &reg; &laquo; &raquo;"
)

replace_html(x)
replace_html(x, FALSE)
replace_white(replace_html(x, FALSE))

trinker/textclean documentation built on Nov. 3, 2021, 7:20 p.m.