--- title: "Working with strings" author: "YOUR NAME HERE" date: "today" format: html: self-contained: true toc: true toc_float: true number_section: false highlight: "tango" theme: "cosmo" editor: visual editor_options: chunk_output_type: console --- ```{r setup, message = FALSE} library(tidyverse) ``` # State names R has built-in vectors with the names of all 50 states in the U.S. ```{r} state.name ``` ## Exercise 1 Run each line below and add comments to the code to indicate what each line is doing. ```{r} str_which(state.name,"V") str_subset(state.name,"V") str_subset(str_to_upper(state.name),"V") str_subset(state.name,"[Vv]") ``` ## Exercise 2 Plot n over time by name for girls whose name starts with “Elizab” but isn’t “Elizabeth” ## Exercise 3 How many unique names are there that contain the string “liz”? ## Exercise 4 Explore variations of your own name ## Exercise 5 What is the most common letter of first names? Has this changed over time? ## Exercise 6 Let's explore the `movies` dataset from the `ggplot2movies` package. + Do movies with longer titles tend to have higher or lower ratings? + Movies with question marks in the title + Movies with colons in the title + etc etc