
Replace spaces in all elements of a character vector with underscores
Source:R/utils.R
replace_spaces.Rd
Replace spaces in all elements of a character vector with underscores
Author
Kelly Sovacool, sovacool@umich.edu
Examples
dat <- data.frame(
dx = c("outcome 1", "outcome 2", "outcome 1"),
a = 1:3, b = c(5, 7, 1)
)
dat$dx <- replace_spaces(dat$dx)
dat
#> dx a b
#> 1 outcome_1 1 5
#> 2 outcome_2 2 7
#> 3 outcome_1 3 1