I think this is my reprex? Not sure if I did that correctly? I'm getting the error from the title after I try to run the houseplot command. I'm not sure why I'm getting the error for the "'womenincongress.csv' does not exist in current working directory " because it is in my wd and it doesn't display that error when I run that line. It only tells me I need to do the column specification but otherwise there's no error.
library(tidyverse)
all_states <- map_data("state")
congress<-read_csv("womenincongress.csv")
#> Error: 'womenincongress.csv' does not exist in current working directory ('C:/Users/clair/AppData/Local/Temp/RtmpqSTZ3O/reprex-36046fbb58b6-bared-pika').
names(congress)[2] <- "region"
#> Error in names(congress)[2] <- "region": object 'congress' not found
stateData <- left_join(all_states,congress,by="region")
#> Error in is.data.frame(y): object 'congress' not found
repProp <- congress$representatives/(congress$total)
#> Error in eval(expr, envir, enclos): object 'congress' not found
housePlot <- ggplot()+geom_polygon(data=stateData,aes(x=long, y=lat, group = group, fill=repProp),color="grey50")+coord_map()+labs(x="",y="",title="Women in the House")+theme_classic()+ theme(axis.ticks.y = element_blank(),axis.text.y = element_blank(), axis.ticks.x = element_blank(),axis.text.x = element_blank())
#> Error in fortify(data): object 'stateData' not found
housePlot
#> Error in eval(expr, envir, enclos): object 'housePlot' not found
Created on 2021-11-29 by the reprex package (v2.0.1)
I'm not sure how to include the congress data, but here is an image of it and a copy of the output:
dput(congress[1:10, ])
structure(list(...1 = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), state = c("alabama",
"arizona", "arkansas", "california", "colorado", "connecticut",
"delaware", "district of columbia", "florida", "georgia"), senators = c(0,
0, 1, 2, 0, 0, 0, 0, 0, 0), representatives = c(2, 3, 0, 19,
1, 2, 0, 1, 7, 0), total = c(7, 9, 4, 53, 7, 5, 1, 1, 27, 14)), row.names = c(NA,
-10L), class = c("tbl_df", "tbl", "data.frame"))