test_that("str_replace_vec works with mutate", { data <- tibble::tibble( x = c("one", "two", "three", "four"), y = c("one apple", "two bananas", "three pear", "four oranges") ) data <- dplyr::mutate(data, x2 = str_replace_vec(x, c( "one" = "1", "two" = "2", "three" = "3", "four" = "4" )) ) expect_identical(data$x2, c("1", "2", "3", "4")) expect_identical(data$y, c("one apple", "two bananas", "three pear", "four oranges")) }) test_that("str_replace_vec with regex", { x <- c("REP_1", "REP1-2", "MR REP 2") x2 <- str_replace_vec(x, c( "(?