drop_tags {mclm} | R Documentation |
Drop XML tags from character string
Description
This function takes a character vector and returns a copy from which all
XML-like tags have been removed. Moreover, if half_tags_too = TRUE
any half tag at the beginning or end of x
is also removed.
Usage
drop_tags(x, half_tags_too = TRUE)
Arguments
x |
String with XML tag |
half_tags_too |
Logical. Whether tags with only opening/closing bracket should also be removed. |
Details
This function is not XML-aware. It uses a very simple definition of what
counts as a tag. More specifically, any character sequence starting with
<
and ending with >
is considered a 'tag'; inside such a tag, between
<
and >
, drop_tags()
accepts any sequence of zero or more characters.
Value
Character string
Examples
xml_snippet <- "id='3'/><w pos='Det'>An</w> <w pos='N'>example</w> <w"
drop_tags(xml_snippet)
drop_tags(xml_snippet, half_tags_too = FALSE)
[Package mclm version 0.2.7 Index]