I think you just need to add + geom_line() to your code which makes the plot. It's not pretty but it adds lines for each state/gender combo. I've also improved your code a bit below to help you learn some tricks - you don't need all those or statements, you can just use %in%
library(readr)
SSA_state.df <- read_delim("https://www.laits.utexas.edu/~mr56267/TLAH_Names_2020/Textbook/SSA_state_level.txt",
delim="\t",
col_types = cols(
state = col_character(),
gender = col_character(),
year = col_integer(),
name = col_character(),
count = col_integer(),
total = col_integer(),
perc = col_double(),
state_name = col_character()
))
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(scales)
#>
#> Attaching package: 'scales'
#> The following object is masked from 'package:readr':
#>
#> col_factor
library(ggplot2)
library(magrittr)
sequence_of_years <- seq(from = 1880, to = 2018, by = 10)
William_state.df <- SSA_state.df %>%
filter(name=="William")
William_NE.df <- William_state.df %>%
filter(state %in%
c("ME", "MA", "RI", "CT", "NH", "VT", "NY", "PA", "NJ", "DE", "MD"))
ggplot(data = William_NE.df, aes(x = year,y = perc, color=gender,
group=interaction(state,gender))) +
geom_point() +
geom_line() +
labs(title="William in the Northeast", x = "Year",
y="Percentage of Total by Gender",
caption="Source: Data from the Social Security Administration") +
scale_x_continuous(breaks = sequence_of_years) +
scale_color_manual(labels= c("Female","Male"), values = c("blue","red"))+
scale_y_log10(labels=prettyNum) +
annotation_logticks()

Created on 2020-02-26 by the reprex package (v0.3.0)