For the inverse, see vector_to_string.

str_to_vctr(string)

Examples

# String to Vector test_vctr <- "c('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J')" str_to_vctr(test_vctr)
#> [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J"
test_vctr <- 'c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")' str_to_vctr(test_vctr)
#> [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J"
test_vctr <- 'c(\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\")' str_to_vctr(test_vctr)
#> [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J"
# Vector to String vctr_to_str(LETTERS[1:5])
#> [1] "c('A', 'B', 'C', 'D', 'E')"
vctr_to_str(LETTERS[1:5], quote = "\"")
#> [1] "c(\"A\", \"B\", \"C\", \"D\", \"E\")"