I'm in the process of trying to make a map. I've been following this guide but using my own data. I'm having trouble at the part where I make the data frame. I have a .csv file but every time I use the code to make the dataframe, I get this warning message:
Warning message: In stri_match_first_regex(string, pattern, opts_regex = opts(pattern)) : argument is not an atomic vector; coercing
The .csv file I'm using has three columns: county, population, and growth rate. Here's the code I'm using:
x <- read.csv("data/ny_counties.csv")
pop_and_growth <- str_match(x, "^([a-zA-Z ]+)county\t.*\t([0-9,]{2,10})\t([0-9,]{2,10}) GrowthRate$")[, -1] %>%
na.omit() %>%
na.omit() %>%
str_replace_all(",", "") %>%
str_trim() %>%
tolower() %>%
as.data.frame(stringsAsFactors = FALSE)
I'm not sure what's wrong here or how to fix it. Any advice?
Also, how do I zoom in on one county? I tried using the following but to no avail.
coord_fixed(xlim = c(-123, -121.0), ylim = c(36, 38), ratio = 1.3)