Wrap strings with flanking characters
wrap(x, left, right = left) dbl_quote(..., sep = "") sngl_quote(..., sep = "") bracket(..., sep = "") brace(..., sep = "") parens(..., sep = "")
x | character to wrap |
---|---|
left, right | character pair to wrap with |
sep, ... | passed to |
wrap("abc", "__") # __abc__#> [1] "__abc__"parens("abc") # (abc)#> [1] "(abc)"sngl_quote("abc") # 'abc'#> [1] "'abc'"dbl_quote("abc") # "abc"#> [1] "\"abc\""bracket("abc") # [abc]#> [1] "[abc]"brace("abc") # {abc}#> [1] "{abc}"#> [1] "name(attribute)"#> [1] "nameattribute"# make your own function like this: # markdown bold bold <- function(...) wrap(paste(...), "**") p("make a word", bold("bold"))#> [1] "make a word**bold**"# see unbold example in ?unwrap