Any thoughts on where I'm messing up? Thanks!
I followed the suggestions from 3548/7 and the examples shown there work, but not this attempt:
library(tidyverse)
df <- tibble(col1 = c("^GSPC", "^IXIC", "^DJI"),
col2 = c(1, 2, 3))
dplyr::mutate_if(df,
is.character,
stringr::str_replace_all,
pattern = "^",
replacement = "")
dplyr::mutate_if(df,
is.character,
stringr::str_replace_all,
pattern = "^GSPC",
replacement = "SP500")
# # A tibble: 3 × 2
## col1 col2
# <chr> <dbl>
# 1 ^GSPC 1
# 2 ^IXIC 2
# 3 ^DJI 3