rmg_has_two_distinct_puncts_inside: Rule P: punctuation characters in a string

Description Usage Arguments Value Examples

View source: R/rmgarbage.R

Description

Strip off the first and last characters of a string. If there are two distinct punctuation characters in the result, then the string is garbage. Stripping off the last two characters as false positives includes those ending with ').' and similar.

Usage

1

Arguments

x

a character vector

last_n

numeric, number of final characters to strip

Value

Logical

Examples

1
2
3
4
5
garbage_string_2p1 <- "'hi!cou?cou,"
garbage_string_2p2 <-  "jean-marc,"

rmg_has_two_distinct_puncts_inside(garbage_string_2p1) # TRUE
rmg_has_two_distinct_puncts_inside(garbage_string_2p2) # FALSE

benmarwick/rmgarbage documentation built on April 19, 2020, 6:06 p.m.