Calculate Median Household Income for Albany Wards using R πŸ—Ί

Calculate Median Household Income for Albany Wards using R πŸ—Ί

A while back I posted similar code using Python, but with R the code is cleaner, simpler.

library(tidycensus)
library(tidyverse)
library(sf)

# shapefile of Albany Wards, project to web mercator 3857
# calculate area of each ward, load Ward field as numeric
# hide extra fields in shapefile
wards <- read_sf('/tmp/Albany Wards.gpkg') %>%
  st_transform(3857) %>%
  mutate(ward_area = st_area(.),
         Ward = as.numeric(Ward)) %>%
  dplyr::select(Ward, ward_area)

# get median household income, re-project
# to web mercator 3857
income<- get_acs(
  geography = "tract",
  state='ny',
  county='Albany',
  variables = "B19013_001",
  year = 2020,
  survey = "acs5",
  geometry = T
) %>%
  st_transform(3857)


# intersect income against wards
# calculate percent of ward's area in each census tract
# group back together as a single ward
# create a weighted-mean of median household inco
# rejoin back together with original ward shapefile
income %>%
  st_intersection(wards) %>%
  mutate(percent_of_ward = (st_area(.) / ward_area) %>% units::drop_units() ) %>%
  st_drop_geometry() %>%
  group_by(Ward) %>%
  summarise(estimate = weighted.mean(estimate, percent_of_ward, na.rm=T)) %>%
inner_join(wards, ., by=c('Ward'))

Here is what is produced, with geometry columns suppressed (exclude the last line above when you don’t need the other information for mapping).

    Ward estimate
<dbl> <dbl>
1 1 57500.
2 2 46544.
3 3 37274.
4 4 39713.
5 5 38127.
6 6 47070.
7 7 47915.
8 8 86490.
9 9 57688.
10 10 44964.
11 11 33290.
12 12 69262.
13 13 67333.
14 14 78489.
15 15 72368.

South Buffalo Brownfield Remediation Sites

TSDR Hazardous Waste Sites on National Priorities List (NPL) represents georeferenced data for 1,572 NPL Superfund sites. The purpose is to provide an easily accessible data set of polygons for hazardous waste sites in the United States which can be used to identify nearby populations and assess their potential risk. Dataset Summary The Agency for Toxic Substances and Disease Registry (ATSDR) Hazardous Waste Sites on National Priorities List (NPL) is a database providing georeferenced data for 1,572 National Priorities List (NPL) Superfund sites. Data Source: NYS Department of State. http://opdgig.dos.ny.gov/arcgis/rest/services/NYOPDIG/PhysicalData/MapServer/41

Upcoming Moon Cycles

Upcoming Moon Phases:

Day Month Day Phase Moon-Rise Moon-Set
Friday June 3 Waxing Crescent πŸŒ’ Monday 1:51 am
east-northeast
67°
Monday 2:14 pm
west-northwest
294°
Wednesday June 8 First Quarter πŸŒ“ Saturday 5:59 am
east-northeast
67°
Saturday 6:21 pm
west-northwest
291°
Saturday June 11 Waxing Gibbous πŸŒ” Tuesday 8:16 am
east
81°
Tuesday 8:37 pm
west
276°
Wednesday June 15 Strawberry πŸ“ Full 🌝 east-southeast
105°
west-southwest
252°
Saturday June 18 Waining Gibbous πŸŒ– Tuesday 2:18 pm
east-southeast
117°
Tuesday 1:45 am
west-southwest
244°
Wednesday June 22 Last Quarter πŸŒ— Saturday 6:20 pm
east-southeast
107°
Saturday 5:52 am
west-southwest
250°
Saturday June 25 Waining Crescent 🌘 Tuesday 8:45 pm
east
89°
Tuesday 8:21 am
west
268°
DOW Month Day Phase Moon-Rise Moon-Set
Wednesday June 29 New 🌚
Sunday July 3 Waxing Crescent πŸŒ’ Wednesday 2:14 am
east-northeast
63°
Wednesday 2:38 pm
west-northwest
297°
Thursday July 7 First Quarter πŸŒ“ Sunday 5:27 am
east-northeast
73°
Sunday 5:48 pm
west-northwest
284°
Monday July 11 Waxing Gibbous πŸŒ” Thursday 8:24 am
east
97°
Thursday 8:47 pm
west
260°
Thursday July 14 Buck 🦌 Full 🌝 east-southeast
113°
west-southwest
245°
Monday July 18 Waining Gibbous πŸŒ– Thursday 3:13 pm
east-southeast
113°
Thursday 2:41 am
west-southwest
245°
Thursday July 21 Last Quarter πŸŒ— Sunday 5:52 pm
east
98°
Sunday 5:27 am
west
259°
Monday July 25 Waining Crescent 🌘 Thursday 8:54 pm
east-northeast
74°
Thursday 8:30 am
west-northwest
283°
DOW Month Day Phase Moon-Rise Moon-Set
Friday July 29 New 🌚
Tuesday August 2 Waxing Crescent πŸŒ’ Friday 2:36 am
east-northeast
68°
Friday 2:58 pm
west-northwest
290°
Saturday August 6 First Quarter πŸŒ“ Tuesday 5:34 am
east
88°
Tuesday 5:54 pm
west
269°
Tuesday August 9 Waxing Gibbous πŸŒ” Friday 7:56 am
east-southeast
106°
Friday 8:22 pm
west-southwest
251°
Saturday August 13 Strugeon 🐑 Full 🌝 east-southeast
117°
west-southwest
244°
Tuesday August 16 Waining Gibbous πŸŒ– Friday 2:54 pm
east-southeast
106°
Friday 2:26 am
west-southwest
251°
Friday August 19 Last Quarter πŸŒ— Monday 5:18 pm
east
88°
Monday 4:54 am
west
269°
Tuesday August 23 Waining Crescent 🌘 Friday 8:22 pm
east-northeast
68°
Friday 7:57 am
west-northwest
291°
DOW Month Day Phase Moon-Rise Moon-Set
Saturday August 27 New 🌚
Wednesday August 31 Waxing Crescent πŸŒ’ Saturday 2:02 am
east-northeast
75°
Saturday 2:24 pm
west-northwest
283°
Sunday September 4 First Quarter πŸŒ“ Wednesday 4:58 am
east
98°
Wednesday 5:21 pm
west-southwest
259°
Thursday September 8 Waxing Gibbous πŸŒ” Sunday 8:38 am
east-southeast
117°
Sunday 9:09 pm
west-southwest
243°
Sunday September 11 Harvest 🌽 Full 🌝 east-southeast
113°
west-southwest
249°
Wednesday September 14 Waining Gibbous πŸŒ– Saturday 2:25 pm
east
97°
Saturday 2:00 am
west
260°
Sunday September 18 Last Quarter πŸŒ— Wednesday 5:29 pm
east-northeast
73°
Wednesday 5:05 am
west-northwest
284°
Thursday September 22 Waining Crescent 🌘 Sunday 8:46 pm
east-northeast
63°
Sunday 8:17 am
west-northwest
297°
DOW Month Day Phase Moon-Rise Moon-Set
Monday September 26 New 🌚
Friday September 30 Waxing Crescent πŸŒ’ Monday 2:07 am
east
90°
Monday 2:28 pm
west
267°
Tuesday October 4 First Quarter πŸŒ“ Friday 5:24 am
east-southeast
112°
Friday 5:52 pm
west-southwest
246°
Friday October 7 Waxing Gibbous πŸŒ” Monday 8:32 am
east-southeast
117°
Monday 9:02 pm
west-southwest
244°
Monday October 10 Hunter 🏹 Full 🌝 east-southeast
105°
west-southwest
258°
Friday October 14 Waining Gibbous πŸŒ– Monday 2:37 pm
east
80°
Monday 2:13 am
west
277°
Tuesday October 18 Last Quarter πŸŒ— Friday 5:49 pm
east-northeast
64°
Friday 5:22 am
west-northwest
295°
Saturday October 22 Waining Crescent 🌘 Tuesday 9:08 pm
east-northeast
67°
Tuesday 8:43 am
west-northwest
294°

Weather Update – May 30, 2022

Sunny and hot the next few days β˜€

Then rain showers, cooler and very pleasant for next weekend.

Memorial Day.
Hot !

Mostly Sunny

Mostly sunny.

Calm wind becoming west around 6 mph in the afternoon.

and

89 degrees , 61 max dew point, 8:26
sunset.
Tonight.
Hot !

Partly Cloudy

Partly cloudy.

Light south wind.

and

67 degrees , 62 max dew point, 5:18
sunrise.
Tuesday.
Hot !

Hot

Mostly sunny and hot.

Northwest wind 5 to 10 mph, with gusts as high as 20 mph.

and

91 degrees , 64 max dew point, 8:27
sunset.
Tuesday Night.
Feels like …
July 10th.

Slight Chance of T-storms then Slight Chance of Showers

A slight chance of showers and thunderstorms before 2am, then a slight chance of showers after 3am. Partly cloudy.

Northwest wind around 6 mph becoming calm in the evening. Chance of precipitation is 20%.

and

62 degrees , 60 max dew point, 5:18
sunrise.
Wednesday.
Feels like …
June 8th.

Chance of Showers then Showers is likely

A chance of showers before 11am, then a chance of showers and thunderstorms between 11am and 2pm, then showers likely and possibly a thunderstorm after 2pm. Partly sunny.

South wind 6 to 8 mph. Chance of precipitation is 70%. New rainfall amounts between a tenth and quarter of an inch, except higher amounts possible in thunderstorms.

and

77 degrees , 61 max dew point, 8:28
sunset.
Wednesday Night.
Feels like …
June 15th.

Showers is likely

Showers likely and possibly a thunderstorm before 8pm, then a chance of showers and thunderstorms between 8pm and 2am, then a chance of showers after 2am. Mostly cloudy.

Chance of precipitation is 60%. New rainfall amounts of less than a tenth of an inch, except higher amounts possible in thunderstorms.

and

57 degrees , 5:18
sunrise.
Thursday.
Feels like …
May 31st.

Partly Sunny

Partly sunny.

and

75 degrees , 54 max dew point, 8:28
sunset.
Thursday Night.
Feels like …
June 8th.

Mostly Cloudy then Chance of Showers

A chance of showers after 2am. Mostly cloudy.

Chance of precipitation is 30%.

and

55 degrees , 5:17
sunrise.
Friday.
Feels like …
May 27th.

Chance of Showers

A chance of showers. Partly sunny.

Chance of precipitation is 30%.

and

74 degrees , 53 max dew point, 8:29
sunset.
Friday Night.
Feels like …
May 26th.

Partly Cloudy

Partly cloudy.

and

51 degrees , 5:17
sunrise.
Saturday.
Feels like …
June 8th.

Sunny

Sunny.

and

77 degrees , 49 max dew point, 8:30
sunset.
Saturday Night.
Feels like …
June 5th.

Partly Cloudy

Partly cloudy.

and

54 degrees , 5:16
sunrise.
Sunday.
Feels like …
June 11th.

Mostly Sunny

Mostly sunny.

and

78 degrees , 51 max dew point, 8:31
sunset.