I'm new to both this forum and R. I'm working on a ecological study and using census data to develop a dataset in Washington State divided by zip code with the following variables: "total_pop", "median age", "median age men", "median age women", "total pop men", "total pop women", "white", "black", "american indian/alskan", "asian", "native hawaiian", "other race", "2+ races". I used a package I found online called tidycensus to get data from the ACS 5-year estimate dataset and I ran into a couple of issues which I was hoping that you could help me with.
My main issue is that the data set isn't configured to my liking. I had envisioned that the data set would have an ouput with zip codes being the rows and the columns being the variables such that each zip code will have the 14 associated variables. For example, for a given zip code (12345) in the year 2018 I would like the (top) configuration rather than the bottom configuration which is what I am currently getting. desired configuration
This is an example of the current data that I captured. [current dataset]2
Another issue I've been having is that the get_acs function in the package can't give me zip-codes in a particular state but the entire US so my data set currently has a majority of zip-codes that I don't need. If I was to find all the zipcodes in the Washington state is there a way to only include those zipcodes specific to Washington State. Thank you all for the help in advance, I'd like to reiterate that I am most certainly a novice in R so any/all help would be greatly appreciated.