So, I have some data I'm working with where I'm analyzing the cost of solar panels placed in different neighborhoods.
SOL2010<-mainframe%>%
filter(year==2010)%>%
group_by(Name)%>%
summarize(sum(DECLARED_VALUATION))
So, when I run this, I can make some nice choropleths eventually, but here's my problem. My filters limit my eventual dataframe to only the neighborhoods that actually placed solar panels. And this changes with each year; When I try to do some tmaps stuff, it sets anything without a name as "missing" rather than 0, which is what I would want.
My problem seems to be that there are some neighborhoods that have never had any solar panel projects, and so those neighborhoods are NA'ed, instead of being 0.
Ideally, I'd be able to do something where I set the sum(Declared_Valuation) of any neighborhood that doesn't exist as 0, but this would require me putting the missing neighborhoods back into the original dataframe. From my original dataframe, I could get a list of the neighborhood as factors; would that help me programatically get the missing neighborhoods into my dataframes?