String Manipulation with stringr in R
Charlotte Wickham
Assistant Professor at Oregon State University
my_toppings
"green peppers" "olives" "onions"
paste(c("", "", "and "), my_toppings, sep = "")
"green peppers" "olives" "and onions"
library(stringr)
str_c(c("", "", "and "), my_toppings)
"green peppers" "olives" "and onions"
str_length()
, str_sub()
library(babynames)
head(babynames)
year sex name n prop
1 1880 F Mary 7065 0.07238359
2 1880 F Anna 2604 0.02667896
3 1880 F Emma 2003 0.02052149
4 1880 F Elizabeth 1939 0.01986579
5 1880 F Minnie 1746 0.01788843
6 1880 F Margaret 1578 0.01616720
String Manipulation with stringr in R