str_replace_us: Replace underscores with spaces or _vice versa_

Description Usage Arguments Details Value Examples

View source: R/str_replace_us.R

Description

Vectorised over string, to replace underscores with spaces or vice versa.

Usage

1
2
3

Arguments

string

"Input vector. Either a character vector, or something coercible to one." (from ?stringr::str_replace_all)

Details

These two functions are thin wrappers around str_replace_all() from the 'stringr' package. They just pass a space (" ") or an underscore ("_") to the parameters pattern and replacement, automatically. (Yes, I do this often enough to warrant adding two new functions to my namespace!)

Value

"A character vector." (from ?stringr::str_replace_all)

Examples

1
2
3
4
5
txt <- "This_is_a_string"
str_replace_us(txt)

txt <- "This is a string"
str_replace_sp(txt)

jhrcook/jhcutils documentation built on Sept. 2, 2020, 7:16 a.m.