[R-sig-Geo] Mapping census tracts with leaflet(): "sf layer has inconsistent datum" error
Hello, all. Newbie to sf, tidycensus and the tidyverse here. First off, is this the appropriate list to ask this question? If not, let me know and I'll go away. I'm trying to map census blocks for my neighborhood to a base map. I'm using tidycensus to get the geometry of the census blocks, and leaflet to map them to the OSM base maps. Mostly, this is going really well, and I'm very pleased with the speed of development (I just started this morning) and results. However, I get this error: Warning message: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs). Need '+proj=longlat +datum=WGS84' I think I need to use st_transform, but can't get it to work. Here's a reproducible example, with some commented out lines of what I've tried: ## Reproducible example: library(tidyverse) library(tidycensus) library(leaflet) library(sf) rw_blocks <- c(3000, 3001, 3002, 3005, 3006, 3007, 3008, 3009, 3010, 3011) rw_pop <- get_decennial( geography = "block", variables = "P1_001N", year = 2020, state = "MD", county = "Baltimore city", geometry = TRUE ) %>% filter(substr(GEOID, 6, 11) == "271101" & substr(GEOID, 12, 15) %in% rw_blocks ) ## %>% st_transform('+proj=longlat +datum=WGS8') (rw_pop_map <- rw_pop %>% leaflet() %>% ## st_transform('+proj=longlat +datum=WGS8') %>% fitBounds(-76.616, 39.352, -76.610, 39.346) %>% addTiles() %>% addPolygons() ) ## Error occurs when executing above block Can anyone offer me a hint as to how to resolve this error? Thanks so much for any advice and guidance. -Kevin ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Mapping census tracts with leaflet(): "sf layer has inconsistent datum" error
Ben and Olivier, thank you so much for your help, and the additional resources you provided. You helped me not only fix my problem, but also to understand what caused it. Thanks, again. -Kevin On 5/31/23 18:16, Ben Tupper wrote: > Hi, > > This is a great place to ask - and nice reproducible code! > > You have a two issues as far as I can see. First it seems you have > dropped the "4" in "WGS84". And second you want to transform rw_pop, > not the output of leaflet(). The following works for me. > > ## Start > library(tidyverse) > library(tidycensus) > library(leaflet) > library(sf) > > rw_blocks <- c(3000, 3001, 3002, 3005, 3006, 3007, 3008, 3009, 3010, 3011) > > rw_pop <- get_decennial( > geography = "block", > variables = "P1_001N", > year = 2020, > state = "MD", > county = "Baltimore city", > geometry = TRUE > ) %>% > filter(substr(GEOID, 6, 11) == "271101" & > substr(GEOID, 12, 15) %in% rw_blocks > ) ## %>% st_transform('+proj=longlat +datum=WGS8') > > (rw_pop_map <- rw_pop %>% > st_transform('+proj=longlat +datum=WGS84') %>% > leaflet() %>% > fitBounds(-76.616, 39.352, -76.610, 39.346) %>% > addTiles() %>% > addPolygons() > ) > ## End > > On Wed, May 31, 2023 at 4:03 PM Kevin Zembower via R-sig-Geo > mailto:r-sig-geo@r-project.org>> wrote: > > Hello, all. Newbie to sf, tidycensus and the tidyverse here. > > First off, is this the appropriate list to ask this question? If not, > let me know and I'll go away. > > I'm trying to map census blocks for my neighborhood to a base map. I'm > using tidycensus to get the geometry of the census blocks, and leaflet > to map them to the OSM base maps. Mostly, this is going really well, > and > I'm very pleased with the speed of development (I just started this > morning) and results. > > However, I get this error: > > Warning message: > sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs). > Need '+proj=longlat +datum=WGS84' > > I think I need to use st_transform, but can't get it to work. > > Here's a reproducible example, with some commented out lines of what > I've tried: > > ## Reproducible example: > library(tidyverse) > library(tidycensus) > library(leaflet) > library(sf) > > rw_blocks <- c(3000, 3001, 3002, 3005, 3006, 3007, 3008, 3009, 3010, > 3011) > > rw_pop <- get_decennial( > geography = "block", > variables = "P1_001N", > year = 2020, > state = "MD", > county = "Baltimore city", > geometry = TRUE > ) %>% > filter(substr(GEOID, 6, 11) == "271101" & > substr(GEOID, 12, 15) %in% rw_blocks > ) ## %>% st_transform('+proj=longlat +datum=WGS8') > > (rw_pop_map <- rw_pop %>% > leaflet() %>% > ## st_transform('+proj=longlat +datum=WGS8') %>% > fitBounds(-76.616, 39.352, -76.610, 39.346) %>% > addTiles() %>% > addPolygons() > ) > ## Error occurs when executing above block > > Can anyone offer me a hint as to how to resolve this error? > > Thanks so much for any advice and guidance. > > -Kevin > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org <mailto:R-sig-Geo@r-project.org> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > <https://stat.ethz.ch/mailman/listinfo/r-sig-geo> > ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R-sig-Geo] Adding a text-only label to a leaflet map?
Hello, all, With Ben and Olivier's help, I was able to plot my neighborhood's census blocks and tracts on an OSM base map, with leaflet, without warnings. My next problem is labeling the polygons I've plotted. Here's an example of what I've tried so far: ## Reproducible example library(tidycensus) library(tidyverse) library(sf) library(tigris) options(tigris_use_cache = TRUE) library(leaflet) library(leafem) rw_tracts <- tracts(state = "MD", county = "Baltimore city", year = "2020") %>% filter(TRACTCE == "271101") %>% st_transform('+proj=longlat +datum=WGS84') lopot = labelOptions(noHide = TRUE, direction = 'top', textOnly = TRUE) rw_tracts %>% leaflet() %>% addTiles() %>% addPolygons(color = "#00E600") %>% ## addAwesomeMarkers(lng = -76.62, lat = 39.352, ## label = "2711.01", ## labelOptions( ## noHide = TRUE, ## direction = 'top', ## textOnly = TRUE, ## opacity = 1, ## textsize = "60px", ## style = list( ## "color" = "#FF", ## "#00E600", ## "font-weight" = "bold") ## ), ## options = markerOptions( ## ## interactive = FALSE, ## ## clickable = FALSE, ## ## draggable = FALSE, ## ## keyboard = FALSE, ## ), ## ) %>% addStaticLabels( lng = -76.63, lat = 39.36, label = "2711.01", style = list("color" = "#009900", "font-weight" = "bold", "font-size" = "60px") ) %>% addLabelOnlyMarkers( label = "2711.01", lng = -76.613, lat = 39.348, labelOptions(noHide = TRUE, direction = 'top', textOnly = TRUE, opacity = 1, textsize = "60px", style = list("color" = "#FF", ## "#00E600", "font-weight" = "bold") ) ) So far, the addStaticLabels() example comes closest to what I want. However, I need to move the label to a different location, and it doesn't seem to respond to the lng and lat options (but doesn't throw an error, either). Also, I'm concerned that the leafem package comes with a warning that it's based on deprecated packages. addAwesomeMarkers() put the marker when I wanted it, and my label appeared when I clicked or moused over it, but I just want a static label. addLabelOnlyMarker() seems designed for my use-case, but I can't get anything to appear. Not sure what I'm doing wrong there. Finally, all these methods seem like a lot of work. Am I overlooking something simple? I just need static text, that I can control the location, size and color of. Is this the way to do it? Thanks, again, for your advice and guidance. -Kevin ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R-sig-Geo] Adding Census polygons to OSM map?
Hello, again, I've given up my work with leaflet, trying to map my neighborhood with US Census boundaries. Even though it was quick and easy to add the Census boundaries to the map, I couldn't create the labels I wanted (see https://stat.ethz.ch/pipermail/r-sig-geo/2023-June/029284.html). Also, it seems like leaflet added a lot of overhead that I didn't need, such as interactive maps. I just need a color printed 2D map for my use. I'm now trying to work with tigris and OpenStreetMap, but I can't draw the US Census boundaries on the OSM map. Here's what I have so far: == ## Experiment, using sf: library(tidyverse) library(tigris) options(tigris_use_cache = TRUE) library(sf) library(OpenStreetMap) ## library(sp) ## library(ggplot2) lat_max <- 39.3525 #Distance from 39.35 to 39.34 = 0.691mi long_max <- -76.617 #Distance from -76.61 to -76.62 = 0.5343 mi lat_min <- 39.3455 long_min <- -76.6095 nw <- c(lat_max, long_max) se <- c(lat_min, long_min) rw_map <- openmap(nw, se, type = "osm", mergeTiles = TRUE) %>% openproj() %>% OpenStreetMap::autoplot.OpenStreetMap() + xlab("long") + ylab("lat") rw_map rw_tract <- tracts(state = "MD", county = "Baltimore city", year = "2020") %>% filter(NAME == "2711.01") ## openproj() ## st_transform('+proj=longlat +datum=WGS84') ## spTransform('osm') OpenStreetMap::autoplot.OpenStreetMap(rw_tract, add = TRUE) == The commented out sections show some of the things I've tried so far. I'd like to be able to draw the rw_tract geometry data on the rw_map image. What I'd like is a 'addPolygon()' function in OpenStreetMap, like I found in leaflet. Can anyone offer me any suggestions or advice for accomplishing my task? Thanks so much. -Kevin ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Adding Census polygons to OSM map?
Tim, thank you very much. Yes, tmap seems to be moving in the right direction for me. This is what I can do with it so far: = ## Trying with tmap: library(tidyverse) library(sf) library(tmap) library(terra) library(spData) library(spDataLarge) library(tigris) options(tigris_use_cache = TRUE) library(OpenStreetMap) ## Get an Open Street Map: rw_map <- openmap(nw, se, type = "osm", mergeTiles = TRUE) %>% openproj(projection = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") ## Get an example census map: rw_tract <- tracts(state = "MD", county = "Baltimore city", year = "2020") %>% filter(NAME == "2711.01") ttm() ## Quick Tmap; also works: qtm(rw_tract) ## Also works. _polygons combines _fill and _borders: tm_shape(rw_tract) + tm_polygons() ## Works: tm_shape(rw_tract) + tm_polygons(alpha = 0.2, col = "green") + tm_scale_bar() + tm_layout(title = "Radnor-Winston Neighborhood") + tm_basemap(server = "OpenStreetMap") === So, in that last example, I can plot the basemap from Open Street Maps with the Census tract on top of it. However, from what I've learned so far (just about 4 hours of study), tm_basemap() only works with interactive maps that are 'viewed' (in a browser as HTML) rather than plotted (printed). I don't understand why I can't just get the appearance I want without all the unwanted interactivity features. To take it a step further, I don't understand why I can't just plot both the basemap and the census tract with something like plot() (from ggplot) and sf. Thanks, again, Tim, for your suggestion. I think it's moving me in the right direction. -Kevin On 6/7/23 10:57, Howard, Tim G (DEC) wrote: > Kevin, > the tmap package might be what you are looking for. > > https://cran.r-project.org/web/packages/tmap/vignettes/tmap-getstarted.html > > https://cran.r-project.org/web/packages/tmap/index.html > > > Cheers, > Tim > > From: R-sig-Geo on behalf of Kevin Zembower > via R-sig-Geo > Sent: Monday, June 5, 2023 11:21 AM > To: r-sig-geo@r-project.org > Subject: [R-sig-Geo] Adding Census polygons to OSM map? > > ATTENTION: This email came from an external source. Do not open attachments > or click on links from unknown senders or unexpected emails. > > > Hello, again, > > I've given up my work with leaflet, trying to map my neighborhood with > US Census boundaries. Even though it was quick and easy to add the > Census boundaries to the map, I couldn't create the labels I wanted (see > https://stat.ethz.ch/pipermail/r-sig-geo/2023-June/029284.html). Also, > it seems like leaflet added a lot of overhead that I didn't need, such > as interactive maps. I just need a color printed 2D map for my use. > > I'm now trying to work with tigris and OpenStreetMap, but I can't draw > the US Census boundaries on the OSM map. Here's what I have so far: > > == > ## Experiment, using sf: > library(tidyverse) > library(tigris) > options(tigris_use_cache = TRUE) > library(sf) > library(OpenStreetMap) > ## library(sp) > ## library(ggplot2) > > lat_max <- 39.3525 #Distance from 39.35 to 39.34 = 0.691mi > long_max <- -76.617 #Distance from -76.61 to -76.62 = 0.5343 mi > lat_min <- 39.3455 > long_min <- -76.6095 > nw <- c(lat_max, long_max) > se <- c(lat_min, long_min) > > rw_map <- openmap(nw, se, > type = "osm", > mergeTiles = TRUE) %>% > openproj() %>% > OpenStreetMap::autoplot.OpenStreetMap() + > xlab("long") + ylab("lat") > > rw_map > > rw_tract <- tracts(state = "MD", > county = "Baltimore city", > year = "2020") %>% > filter(NAME == "2711.01") > ## openproj() > ## st_transform('+proj=longlat +datum=WGS84') > ## spTransform('osm') > > OpenStreetMap::autoplot.OpenStreetMap(rw_tract, add = TRUE) > == > > The commented out sections show some of the things I've tried so far. > I'd like to be able to draw the rw_tract geometry data on the rw_map > image. What I'd like is a 'addPolygon()' function in OpenStreetMap, like > I found in leaflet. > > Can anyone offer me any suggestions or advice for accomplishing my task? > Thanks so much. > > -Kevin > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Adding Census polygons to OSM map?
semap(server = "OpenStreetMap") >>> >>> === >>> >>> So, in that last example, I can plot the basemap from Open Street Maps >>> with the Census tract on top of it. However, from what I've learned so >>> far (just about 4 hours of study), tm_basemap() only works with >>> interactive maps that are 'viewed' (in a browser as HTML) rather than >>> plotted (printed). I don't understand why I can't just get the >>> appearance I want without all the unwanted interactivity features. >>> >>> To take it a step further, I don't understand why I can't just plot >>> both the basemap and the census tract with something like plot() (from >>> ggplot) and sf. >>> >>> Thanks, again, Tim, for your suggestion. I think it's moving me in the >>> right direction. >>> >>> -Kevin >>> >>> On 6/7/23 10:57, Howard, Tim G (DEC) wrote: >>>> Kevin, >>>> the tmap package might be what you are looking for. >>>> >>>> https://cr/ >>>> >> an%2F&data=05%7C01%7Ctim.howard%40dec.ny.gov%7Cbe436282b0844b9c >> a99a0 >>>> >> 8db681f6989%7Cf46cb8ea79004d108ceb80e8c1c81ee7%7C0%7C0%7C6382182 >> 5635 >>>> >> 1940428%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV >> 2luMzIi >>>> >> LCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=X4Cm12TD >> 2iIH498 >>>> sJlRMPzOFz7IX9XuVdhGX8%2FO0Lv4%3D&reserved=0 >>>> .r-project.org%2Fweb%2Fpackages%2Ftmap%2Fvignettes%2Ftmap- >>> getstarted.h >>>> >>> >> tml&data=05%7C01%7Ctim.howard%40dec.ny.gov%7C4d3f99e6eeff4493a3a >>> 108db6 >>>> >>> >> 7a26858%7Cf46cb8ea79004d108ceb80e8c1c81ee7%7C0%7C0%7C63821771946 >>> 393381 >>>> >>> >> 9%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI >>> iLCJBTiI6 >>>> >>> >> Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MY4b3C%2Bqm7w >>> ycxiX%2F3ww5 >>>> zMLltw59fmCgQTAeSxGu60%3D&reserved=0 >>>> >>>> https://cr/ >>>> >> an%2F&data=05%7C01%7Ctim.howard%40dec.ny.gov%7Cbe436282b0844b9c >> a99a0 >>>> >> 8db681f6989%7Cf46cb8ea79004d108ceb80e8c1c81ee7%7C0%7C0%7C6382182 >> 5635 >>>> >> 1940428%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV >> 2luMzIi >>>> >> LCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=X4Cm12TD >> 2iIH498 >>>> sJlRMPzOFz7IX9XuVdhGX8%2FO0Lv4%3D&reserved=0 >>>> .r- >>> >> project.org%2Fweb%2Fpackages%2Ftmap%2Findex.html&data=05%7C01%7 >>> Ctim >>>> >>> >> .howard%40dec.ny.gov%7C4d3f99e6eeff4493a3a108db67a26858%7Cf46cb8e >>> a7900 >>>> >>> >> 4d108ceb80e8c1c81ee7%7C0%7C0%7C638217719463933819%7CUnknown%7 >>> CTWFpbGZs >>>> >>> >> b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn >>> 0%3D >>>> >>> >> %7C3000%7C%7C%7C&sdata=R61uJO4g0WW1GLh47uXGCB%2FX6%2B9grO4 >>> WYue3XxkfdQ0 >>>> %3D&reserved=0 >>>> >>>> >>>> Cheers, >>>> Tim >>>> >>>> From: R-sig-Geo on behalf of Kevin >>>> Zembower via R-sig-Geo >>>> Sent: Monday, June 5, 2023 11:21 AM >>>> To: r-sig-geo@r-project.org >>>> Subject: [R-sig-Geo] Adding Census polygons to OSM map? >>>> >>>> ATTENTION: This email came from an external source. Do not open >>> attachments or click on links from unknown senders or unexpected emails. >>>> >>>> >>>> Hello, again, >>>> >>>> I've given up my work with leaflet, trying to map my neighborhood >>>> with US Census boundaries. Even though it was quick and easy to add >>>> the Census boundaries to the map, I couldn't create the labels I >>>> wanted (see >>>> https://st/ >>>> >> at%2F&data=05%7C01%7Ctim.howard%40dec.ny.gov%7Cbe436282b0844b9c >> a99a0 >>>> >> 8db681f6989%7Cf46cb8ea79004d108ceb80e8c1c81ee7%7C0%7C0%7C6382182 >> 5635 >>>> >> 1940428%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV >> 2luMzIi >>>> >> LCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QJgBzdN0a >> pmJ61x >>>> gwFp8pY3WQLOSTjt2YVdJGX681q0%3D&
[R-sig-Geo] Mapping my own polygon?
In my continuing work on reporting on US Census data for my neighborhood, I'd like to draw a map of the boundaries of it. I was successful in creating and printing an OSM basemap, with the US Census blocks that make up my neighborhood on it. Now, I'd like to create my own polygon, of the boundaries of my neighborhood, because the census blocks don't line up exactly with the neighborhood boundaries. I need help creating a polygon that I can submit to read_osm() that will correctly return an OSM map of my area. Here's what I've tried so far: ## Reproducible simple example: library(tidyverse) library(sf) rw <- data.frame( ## Simplified neighborhood rectangle Longitude = c(-8528150, -8528500, -8528500, -8528150), Latitude = c( 4771475, 4771475, 4771880, 4771880) ) rw ## Returns (as expected): > rw Longitude Latitude 1 -8528150 4771475 2 -8528500 4771475 3 -8528500 4771880 4 -8528150 4771880 > rw %>% st_as_sf(coords = c("Longitude", "Latitude"), dim = "XY") %>% st_set_crs(6487) %>% ## CRS 6487 is NAD83 (2011) Maryland in meters st_transform(crs = 4269) ## CRS 4269 is NAD83 ## Returns: Simple feature collection with 4 features and 0 fields Geometry type: POINT Dimension: XY Bounding box: xmin: 171.777 ymin: 24.65904 xmax: 171.7818 ymax: 24.66314 Geodetic CRS: NAD83 geometry 1 POINT (171.7818 24.66192) 2 POINT (171.7806 24.65904) 3 POINT (171.777 24.66026) 4 POINT (171.7781 24.66314) > I expected the POINTS to look like: 1 POINT (-76.61246 39.35010) Can anyone suggest what I'm doing wrong? Thanks so much in advance. I've worked on it all day today, without making much progress. -Kevin ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Mapping my own polygon?
Hi, Mike, thanks for answering me from across the world! I created my polygon of my neighborhood the old fashion way: by printing a map with a grid in meters, and using a pair of navigational dividers to pick off the x and y coordinates of the borders of my neighborhood. You can see a map of my neighborhood, drawn by someone else, at https://www.radnorwinston.org/, if you're curious. Here's code to generate a map of this area, one with degrees lat/long, and the one I used, with a grid of meters: === ## This gives degrees lat long: library(tidyverse) library(tigris) options(tigris_use_cache = TRUE) library(sf) library(OpenStreetMap) lat_max <- 39.3525 long_max <- -76.617 lat_min <- 39.3455 long_min <- -76.6095 nw <- c(lat_max, long_max) se <- c(lat_min, long_min) rw_map <- openmap(nw, se, type = "osm", mergeTiles = TRUE) %>% openproj() %>% OpenStreetMap::autoplot.OpenStreetMap() + xlab("long") + ylab("lat") rw_map ## This gives map with grid in meters: library(tidyverse) library(tidycensus) library(sf) library(tmap) library(tigris) options(tigris_use_cache = TRUE) library(tmaptools) rw_block_list <- c("3000", "3001", "3002", "3005", "3006", "3007", "3008", "3009", "3010", "3011", "3012") ## Get the RW blocks from the census: rw_blocks <- blocks(state = "MD", county = "Baltimore city", year = "2020") %>% filter(substr(GEOID20, 6, 11) == "271101" & substr(GEOID20, 12, 15) %in% rw_block_list) ## Create a map of just the RW blocks: rw_base_blocks <- read_osm(bb(rw_blocks, ext = 1.3)) tmap_mode("plot") (RW_block_map <- tm_shape(rw_base_blocks) + tm_rgb() + tm_shape(rw_blocks) + tm_fill("MAP_COLORS", alpha = 0.2, palette = "Accent", n = 10) + tm_borders() + tm_scale_bar() + tm_grid() + tm_xlab("Long") + tm_ylab("Lat") + tm_layout(title = "Radnor-Winston Neighborhood") ) === You're right, that I did pick my example "1 POINT (-76.61246 39.35010)" just by picking a random point in my neighborhood, using Google Maps. In the second example that gives the grid in meters, I just assumed that this was CRS 6487, due to it being Maryland and in meters. Was this a bad assumption? How can I tell what the CRS of the return of the call to "read_osm(bb(rw_blocks, ext = 1.3))" is? When I display it, it says: > rw_base_blocks stars object with 3 dimensions and 1 attribute attribute(s), summary of first 1e+05 cells: Min. 1st Qu. MedianMean 3rd Qu. Max. X 0 217224 219.915 238 255 dimension(s): from to offsetdelta refsys values x/y x 1 663 -8528854 1.19942 WGS 84 / Pseudo-Mercator NULL [x] y 1 907 4772338 -1.19981 WGS 84 / Pseudo-Mercator NULL [y] band1 3 NA NA NA red , green, blue > Thanks, again, for your work to help me. Thanks also for introducing me to Github Gist, which I had never heard of before. I'm going to go to that page next and see if I can put this response in there. Take care. -Kevin On 6/11/23 04:04, Michael Sumner wrote: > I took a guess that your coordinates are not in EPSG:6487 but in global > Mercator (EPSG:3857) which seems to give a reasonable region from online > image servers. > > https://gist.github.com/mdsumner/e6997c2f4a54c743e078aca8401537a0 > <https://gist.github.com/mdsumner/e6997c2f4a54c743e078aca8401537a0> > > If that looks ok? Then, simply replace 6487 with 3857 in your code, > but also please take care to track down where your neighbourhood > coordinates for the x,y range came from. 3857 is the infamous global > google mercator, and that might be what you're using or simply close to > it, you should make sure you know. :) > > I'm using in-dev code in the example, it's not because I want you to > use that or advise you to - it's just to keep a record of what I did. I > experimented with the code and scale to guess at what might be the problem. > > If the pic in my gist is not on the right track I'm happy to follow up, > best of luck! > > HTH, Mike > > > > On Sun, Jun 11, 2023 at 5:27 AM Kevin Zembower via R-sig-Geo > mailto:r-sig-geo@r-project.org>> wrote: > > In my continuing work on reporting on US Census data for my > neighborhood, I'd like to draw a map of the boundaries of it. I was >
Re: [R-sig-Geo] Mapping my own polygon?
t; > rw_block_list <- c("3000", "3001", "3002", "3005", "3006", "3007", > "3008", "3009", "3010", "3011", "3012") > > ## Get the RW blocks from the census: > rw_blocks <- blocks(state = "MD", > county = "Baltimore city", > year = "2020") %>% > filter(substr(GEOID20, 6, 11) == "271101" & > substr(GEOID20, 12, 15) %in% rw_block_list) > > ## Create a map of just the RW blocks: > rw_base_blocks <- read_osm(bb(rw_blocks, ext = 1.3)) > > tmap_mode("plot") > > (RW_block_map <- tm_shape(rw_base_blocks) + > tm_rgb() + > tm_shape(rw_blocks) + > tm_fill("MAP_COLORS", alpha = 0.2, palette = "Accent", n = 10) + > tm_borders() + > tm_scale_bar() + > tm_grid() + tm_xlab("Long") + tm_ylab("Lat") + > tm_layout(title = "Radnor-Winston Neighborhood") > ) > === > > You're right, that I did pick my example "1 POINT (-76.61246 39.35010)" > just by picking a random point in my neighborhood, using Google Maps. > > In the second example that gives the grid in meters, I just assumed > that > this was CRS 6487, due to it being Maryland and in meters. Was this a > bad assumption? How can I tell what the CRS of the return of the > call to > "read_osm(bb(rw_blocks, ext = 1.3))" is? When I display it, it says: > > > rw_base_blocks > stars object with 3 dimensions and 1 attribute > attribute(s), summary of first 1e+05 cells: > Min. 1st Qu. Median Mean 3rd Qu. Max. > X 0 217 224 219.915 238 255 > dimension(s): > from to offset delta refsys > values x/y > x 1 663 -8528854 1.19942 WGS 84 / Pseudo-Mercator > NULL [x] > y 1 907 4772338 -1.19981 WGS 84 / Pseudo-Mercator > NULL [y] > band 1 3 NA NA NA red , green, > blue > > > > Thanks, again, for your work to help me. Thanks also for introducing me > to Github Gist, which I had never heard of before. I'm going to go to > that page next and see if I can put this response in there. > > Take care. > > -Kevin > > On 6/11/23 04:04, Michael Sumner wrote: > > I took a guess that your coordinates are not in EPSG:6487 but in > global > > Mercator (EPSG:3857) which seems to give a reasonable region from > online > > image servers. > > > > https://gist.github.com/mdsumner/e6997c2f4a54c743e078aca8401537a0 > <https://gist.github.com/mdsumner/e6997c2f4a54c743e078aca8401537a0> > > > <https://gist.github.com/mdsumner/e6997c2f4a54c743e078aca8401537a0 > <https://gist.github.com/mdsumner/e6997c2f4a54c743e078aca8401537a0>> > > > > If that looks ok? Then, simply replace 6487 with 3857 in your > code, > > but also please take care to track down where your neighbourhood > > coordinates for the x,y range came from. 3857 is the infamous > global > > google mercator, and that might be what you're using or simply > close to > > it, you should make sure you know. :) > > > > I'm using in-dev code in the example, it's not because I want you to > > use that or advise you to - it's just to keep a record of what I > did. I > > experimented with the code and scale to guess at what might be > the problem. > > > > If the pic in my gist is not on the right track I'm happy to > follow up, > > best of luck! > > > > HTH, Mike > > > > > > > > On Sun, Jun 11, 2023 at 5:27 AM Kevin Zembower via R-sig-Geo > > mailto:r-sig-geo@r-project.org> > <mailto:r-sig-geo@r-project.org <mailto:r-sig-geo@r-project.org>>> > wrote: > > > > In my continuing work on reporting on US Census data for my > > neighborhood, I'd like to draw a map of the boundaries of it. > I was > > successful in creating and printing an OSM basemap, with the > US Census > > blocks that make up my neighborhood on it. >
[R-sig-Geo] Calculating median age for a group of US census blocks?
Hello, all, I'd like to obtain the median age for a population in a specific group of US Decennial census blocks. Here's an example of the problem: ## Example of calculating median age of population in census blocks. library(tidyverse) library(tidycensus) counts <- get_decennial( geography = "block", state = "MD", county = "Baltimore city", table = "P1", year = 2020, sumfile = "dhc") %>% mutate(NAME = NULL) %>% filter(substr(GEOID, 6, 11) == "271101" & substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) ) ages <- get_decennial( geography = "block", state = "MD", county = "Baltimore city", table = "P13", year = 2020, sumfile = "dhc") %>% mutate(NAME = NULL) %>% filter(substr(GEOID, 6, 11) == "271101" & substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) ) I have two questions: 1. Is it mathematically valid to multiply the population of a block by the median age of that block (in other words, assign the median age to each member of a block), then calculate the median of those numbers for a group of blocks? 2. Is raw data on the ages of individuals available anywhere else in the census data? I can find tables such as P12, that breaks down the population by age ranges or bins, but can't find specific data of counts per age in years. Thanks for your advice and help. -Kevin ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Calculating median age for a group of US census blocks?
Yes, I see what you mean: > median(c(60, 50, 40, 20, 20, 20)) [1] 30 > median(c(50, 50, 50, 20, 20, 20)) [1] 35 > Thanks so much for that clear example. -Kevin On 8/7/23 14:45, Sean Trende wrote: > This is correct on the second question, at least for more recent censuses. > On the first question, imagine a block where the ages of three individuals > are 60, 50, and 40, and another one where the ages are 20, 20, and 20. Using > your approach you would have 50 * 3 = 150 for the first block, and 20*3 = 60 > for the second block. The median of 60 and 150 is 105. Even dividing that > by three you get 35, which is not the correct median age (30). > > -Original Message- > From: R-sig-Geo On Behalf Of Josiah Parry > Sent: Monday, August 7, 2023 2:38 PM > To: Kevin Zembower > Cc: r-sig-geo@r-project.org > Subject: Re: [R-sig-Geo] Calculating median age for a group of US census > blocks? > > Hey Kevin, I don't think you're going to be able to get individual level data > from the US Census Bureau. The closest you may be able to get is the current > population survey (CPS) which I believe is also available via tidycensus. > Regarding your first question, I'm not sure I follow what your objective is > with it. I would use a geography of census block groups as the measure of > median for census block groups. Otherwise it is unclear how you are defining > what a "group of blocks" is. > > On Mon, Aug 7, 2023 at 2:34 PM Kevin Zembower via R-sig-Geo < > r-sig-geo@r-project.org> wrote: > >> Hello, all, >> >> I'd like to obtain the median age for a population in a specific group >> of US Decennial census blocks. Here's an example of the problem: >> >> ## Example of calculating median age of population in census blocks. >> library(tidyverse) >> library(tidycensus) >> >> counts <- get_decennial( >> geography = "block", >> state = "MD", >> county = "Baltimore city", >> table = "P1", >> year = 2020, >> sumfile = "dhc") %>% >> mutate(NAME = NULL) %>% >> filter(substr(GEOID, 6, 11) == "271101" & >> substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) >> ) >> >> ages <- get_decennial( >> geography = "block", >> state = "MD", >> county = "Baltimore city", >> table = "P13", >> year = 2020, >> sumfile = "dhc") %>% >> mutate(NAME = NULL) %>% >> filter(substr(GEOID, 6, 11) == "271101" & >> substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) >> ) >> >> I have two questions: >> >> 1. Is it mathematically valid to multiply the population of a block by >> the median age of that block (in other words, assign the median age to >> each member of a block), then calculate the median of those numbers >> for a group of blocks? >> >> 2. Is raw data on the ages of individuals available anywhere else in >> the census data? I can find tables such as P12, that breaks down the >> population by age ranges or bins, but can't find specific data of >> counts per age in years. >> >> Thanks for your advice and help. >> >> -Kevin >> >> ___ >> R-sig-Geo mailing list >> R-sig-Geo@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Calculating median age for a group of US census blocks?
Josiah, thanks for your reply. Regarding my objective, I'm trying to compile census statistics for the blocks that make up the neighborhood where I live. It consists of ten census blocks, of which I selected three for simplicity in my example. The census block-group which contains these ten blocks also contains some blocks which are outside of my neighborhood and shouldn't be counted or included. Since I won't be able to calculate the median age from the age and count data, and since the individual data doesn't seem to be available, is it your thought that I can't produce a valid median age for a group of census blocks? Thanks so much for your advice. -Kevin On 8/7/23 14:38, Josiah Parry wrote: > Hey Kevin, I don't think you're going to be able to get individual level > data from the US Census Bureau. The closest you may be able to get is > the current population survey (CPS) which I believe is also available > via tidycensus. Regarding your first question, I'm not sure I follow > what your objective is with it. I would use a geography of census block > groups as the measure of median for census block groups. Otherwise it is > unclear how you are defining what a "group of blocks" is. > > On Mon, Aug 7, 2023 at 2:34 PM Kevin Zembower via R-sig-Geo > mailto:r-sig-geo@r-project.org>> wrote: > > Hello, all, > > I'd like to obtain the median age for a population in a specific group > of US Decennial census blocks. Here's an example of the problem: > > ## Example of calculating median age of population in census blocks. > library(tidyverse) > library(tidycensus) > > counts <- get_decennial( > geography = "block", > state = "MD", > county = "Baltimore city", > table = "P1", > year = 2020, > sumfile = "dhc") %>% > mutate(NAME = NULL) %>% > filter(substr(GEOID, 6, 11) == "271101" & > substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) > ) > > ages <- get_decennial( > geography = "block", > state = "MD", > county = "Baltimore city", > table = "P13", > year = 2020, > sumfile = "dhc") %>% > mutate(NAME = NULL) %>% > filter(substr(GEOID, 6, 11) == "271101" & > substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) > ) > > I have two questions: > > 1. Is it mathematically valid to multiply the population of a block by > the median age of that block (in other words, assign the median age to > each member of a block), then calculate the median of those numbers for > a group of blocks? > > 2. Is raw data on the ages of individuals available anywhere else in > the > census data? I can find tables such as P12, that breaks down the > population by age ranges or bins, but can't find specific data of > counts > per age in years. > > Thanks for your advice and help. > > -Kevin > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org <mailto:R-sig-Geo@r-project.org> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > <https://stat.ethz.ch/mailman/listinfo/r-sig-geo> > ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Calculating median age for a group of US census blocks?
Dexter, Thanks so much for your reply. I wasn't aware of the two sources you cite, and I'll be sure to include them in my work. The open Baltimore website, at https://data.baltimorecity.gov/datasets/neighborhood-1/explore, has statistics for my neighborhood, Radnor-Winston (https://radnorwinston.org).The Baltimore Neighborhood Indicators Alliance at https://bniajfi.org/vital_signs/ lumps us into North Baltimore/Guilford/Homeland, which, as I'm sure you're aware, contains many homes (mansions!) with very different characteristics than the people of Radnor-Winston. Thanks, again, for your help and expertise. I learned a lot from your note. -Kevin On 8/7/23 15:43, Dexter Locke wrote: > Hi Kevin and all, > > Given the binned data, you could count the number of people per age > class for those 10 blocks. You can then express that in a number of > different ways, like percent under 25 years old, or by calculating the > dependency ratio > <https://www.who.int/data/gho/indicator-metadata-registry/imr-details/1119#:~:text=Definition%3A,a%20specific%20point%20in%20time.>. > > I do think it is feasible to calculate an estimated mean from the counts > within groups representing ranges. See, for example, here: > https://stackoverflow.com/questions/18887382/how-to-calculate-the-median-on-grouped-dataset > > <https://stackoverflow.com/questions/18887382/how-to-calculate-the-median-on-grouped-dataset> > > Since you are working in Baltimore, you may consider looking at The > Baltimore Neighborhood Indicators Alliance > https://bniajfi.org/vital_signs/ <https://bniajfi.org/vital_signs/>. > They provide useful data on a range of issues (transportation, crime, > education, environment etc.) including summaries from Census-derived > demographics. What you are seeking may already exist. BNIA creates > neighborhoods or "community statistical areas" (n=55) based on > aggregates of Census data. > > Although not pertaining to age, Baltimore City Planning has paid Census > in the past to aggregate from individual-level Census data to the more > colloquially-used definitions of Baltimore shown here (n = 273): > https://data.baltimorecity.gov/datasets/neighborhood-1/explore?location=39.284832%2C-76.620516%2C12.91 > > <https://data.baltimorecity.gov/datasets/neighborhood-1/explore?location=39.284832%2C-76.620516%2C12.91> > > Best, Dexter > https://dexterlocke.com/ <https://dexterlocke.com/> > > > > > > On Mon, Aug 7, 2023 at 3:02 PM Kevin Zembower via R-sig-Geo > mailto:r-sig-geo@r-project.org>> wrote: > > Josiah, thanks for your reply. > > Regarding my objective, I'm trying to compile census statistics for the > blocks that make up the neighborhood where I live. It consists of ten > census blocks, of which I selected three for simplicity in my example. > The census block-group which contains these ten blocks also contains > some blocks which are outside of my neighborhood and shouldn't be > counted or included. > > Since I won't be able to calculate the median age from the age and > count > data, and since the individual data doesn't seem to be available, is it > your thought that I can't produce a valid median age for a group of > census blocks? > > Thanks so much for your advice. > > -Kevin > > On 8/7/23 14:38, Josiah Parry wrote: > > Hey Kevin, I don't think you're going to be able to get > individual level > > data from the US Census Bureau. The closest you may be able to > get is > > the current population survey (CPS) which I believe is also > available > > via tidycensus. Regarding your first question, I'm not sure I follow > > what your objective is with it. I would use a geography of census > block > > groups as the measure of median for census block groups. > Otherwise it is > > unclear how you are defining what a "group of blocks" is. > > > > On Mon, Aug 7, 2023 at 2:34 PM Kevin Zembower via R-sig-Geo > > mailto:r-sig-geo@r-project.org> > <mailto:r-sig-geo@r-project.org <mailto:r-sig-geo@r-project.org>>> > wrote: > > > > Hello, all, > > > > I'd like to obtain the median age for a population in a > specific group > > of US Decennial census blocks. Here's an example of the problem: > > > > ## Example of calculating median age of population in census > blocks. > > library(tidyverse) > > l
[R-sig-Geo] Calculating median age for a group of US census blocks?
Sorry to resurrect a long-dead thread, but I'm still struggling with my desire to assign a median age to the population in a group of US census blocks. I'm using the data from the US Census table P12, which bins the ages into ranges. I'm convinced (thank you!) that I can't compute the exact median age. Can I compute the lower and upper bounds of the median age? Can I assign all the people in a binned age range (say "20 to 29 years") to the lower limit of the range, then compute the median of those ages, and say that the true median age is between this lower limit and the upper one, computed similarly? If this is valid, how do I deal with the "85 years and older" bin? I have 9 people 85 years and older, out of a total population of 537 people in my group of census blocks. For the lower bounds of the median, I assign all 9 the age of 85. What can I do for the upper bounds? I've done this, and found that the true median age is between 40 and 44 years old, if I drop all the "85 years and older" population as NA. The true mean is between 39.96 and 43.46, similarly. One thought: If there are 9 people in the "85 years and older" group, should I drop them and also drop the 9 youngest ages? I look forward to reading your thoughts. Thank you for any advice and guidance. -Kevin On Tue, 2023-08-08 at 12:00 +0200, r-sig-geo-requ...@r-project.org wrote: > > Message: 2 > Date: Mon, 7 Aug 2023 18:33:41 + > From: Kevin Zembower > To: "r-sig-geo@r-project.org" > Subject: [R-sig-Geo] Calculating median age for a group of US census > blocks? > Message-ID: > <01000189d146bd0d-ecb41aac-0501-46f4-b313-a1faebeff2a9- > 000...@email.amazonses.com> > > Content-Type: text/plain; charset="utf-8" > > Hello, all, > > I'd like to obtain the median age for a population in a specific > group > of US Decennial census blocks. Here's an example of the problem: > > ## Example of calculating median age of population in census blocks. > library(tidyverse) > library(tidycensus) > > counts <- get_decennial( > geography = "block", > state = "MD", > county = "Baltimore city", > table = "P1", > year = 2020, > sumfile = "dhc") %>% > mutate(NAME = NULL) %>% > filter(substr(GEOID, 6, 11) == "271101" & > substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) > ) > > ages <- get_decennial( > geography = "block", > state = "MD", > county = "Baltimore city", > table = "P13", > year = 2020, > sumfile = "dhc") %>% > mutate(NAME = NULL) %>% > filter(substr(GEOID, 6, 11) == "271101" & > substr(GEOID, 12, 15) %in% c(3000, 3001, 3002) > ) > > I have two questions: > > 1. Is it mathematically valid to multiply the population of a block > by > the median age of that block (in other words, assign the median age > to > each member of a block), then calculate the median of those numbers > for > a group of blocks? > > 2. Is raw data on the ages of individuals available anywhere else in > the > census data? I can find tables such as P12, that breaks down the > population by age ranges or bins, but can't find specific data of > counts > per age in years. > > Thanks for your advice and help. > > -Kevin > > > > > -- > > Message: 3 > Date: Mon, 7 Aug 2023 14:38:16 -0400 > From: Josiah Parry > To: Kevin Zembower > Cc: "r-sig-geo@r-project.org" > Subject: Re: [R-sig-Geo] Calculating median age for a group of US > census blocks? > Message-ID: > < > cal3ufujvvczvdtym2v0tmo9u-rmz1zogl8nzdhjk7v8gfc7...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Hey Kevin, I don't think you're going to be able to get individual > level > data from the US Census Bureau. The closest you may be able to get is > the > current population survey (CPS) which I believe is also available via > tidycensus. Regarding your first question, I'm not sure I follow what > your > objective is with it. I would use a geography of census block groups > as the > measure of median for census block groups. Otherwise it is unclear > how you > are defining what a "group of blocks" is. > > -- > > Message: 4 > Date: Mon, 7 Aug 2023 19:00:38 + > From: Kevin Zembower > To: Josiah Parry > Cc: "r-sig-geo@r-project.org" > Subject: Re: [R-sig-Geo] Calculating median age for a group of US > census blocks? > Message-ID: > <01000189d15f6aa3-d32ffe39-a210-436f-9f8f-cc551370f034- > 000...@email.amazonses.com> > > Content-Type: text/plain; charset="utf-8" > > Josiah, thanks for your reply. > > Regarding my objective, I'm trying to compile census statistics for > the > blocks that make up the neighborhood where I live. It consists of ten > census blocks, of which I selected three for simplicity in my > example. > The census block-group which contains these ten blocks also contains > some blocks which are outside of my neig
Re: [R-sig-Geo] Calculating median age for a group of US census blocks?
Dr. Snow, thanks so much for your response to my question. I think I'm going to stick with the lower- and upper-bounds method I described, even though it gives a wider range for the median age than other methods. I read the vignette for 'survival' as well at the chapters on survival from MASS and another book I have, and couldn't make heads or tails of it, much less how to apply it to this question. In the unlikely event of someone asking me to explain or defend my conclusions on median age for my neighborhood population, I would be lost about survival statistics, but could manage, with numerous hand- waves, to explain my method. I'm an old, retired guy who thinks statistics are fun, not someone with any kind of professional training or credentials. Thank you, again, for your thoughtful and thorough response. I appreciate your help. -Kevin On Tue, 2023-09-05 at 11:31 -0600, Greg Snow wrote: > Kevin, > > Your idea of substituting the minimum and maximum values of the > ranges > will work for computing bounds on the median age, and for the median > age you should not need to drop the 85+ group (unless more that 50% > of > people are in that group). The mean is another issue. > > Another approach that may give you a smaller interval and more > statistically justified range would be to turn to survival analysis > techniques and treat the values from the table as interval censored > data. If the data appears to come from a known distribution then you > can use parametric survival techniques to fit the distribution (see > the `survreg` function in the `survival` package). Or, there are > packages that fit non-parametric models to interval censored data > (`Icens` and `interval` for example) that can then be used to > estimate > a confidence interval on the median age (and possibly the mean age, > but with limitations). For the 85+ group you can treat them as right > censored, or interval censored from 85 to infinity, or interval > censored from 85 to some value like 100 or 120 (there is a small > chance that someone in the table could be over 100, but rare, I think > the current oldest reported living person is in the hundred and > teens, > so 120 would be safe). > > On Thu, Aug 31, 2023 at 1:48 PM Kevin Zembower via R-sig-Geo > wrote: > > > > Sorry to resurrect a long-dead thread, but I'm still struggling > > with my > > desire to assign a median age to the population in a group of US > > census > > blocks. I'm using the data from the US Census table P12, which bins > > the > > ages into ranges. > > > > I'm convinced (thank you!) that I can't compute the exact median > > age. > > Can I compute the lower and upper bounds of the median age? Can I > > assign all the people in a binned age range (say "20 to 29 years") > > to > > the lower limit of the range, then compute the median of those > > ages, > > and say that the true median age is between this lower limit and > > the > > upper one, computed similarly? > > > > If this is valid, how do I deal with the "85 years and older" bin? > > I > > have 9 people 85 years and older, out of a total population of 537 > > people in my group of census blocks. For the lower bounds of the > > median, I assign all 9 the age of 85. What can I do for the upper > > bounds? > > > > I've done this, and found that the true median age is between 40 > > and 44 > > years old, if I drop all the "85 years and older" population as NA. > > The > > true mean is between 39.96 and 43.46, similarly. > > > > One thought: If there are 9 people in the "85 years and older" > > group, > > should I drop them and also drop the 9 youngest ages? > > > > I look forward to reading your thoughts. Thank you for any advice > > and > > guidance. > > > > -Kevin > > > > On Tue, 2023-08-08 at 12:00 +0200, r-sig-geo-requ...@r-project.org > > wrote: > > > > > > Message: 2 > > > Date: Mon, 7 Aug 2023 18:33:41 + > > > From: Kevin Zembower > > > To: "r-sig-geo@r-project.org" > > > Subject: [R-sig-Geo] Calculating median age for a group of US > > > census > > > blocks? > > > Message-ID: > > > <01000189d146bd0d-ecb41aac-0501-46f4-b313-a1faebeff2a9- > > > 000...@email.amazonses.com> > > > > > > Content-Type: text/plain; charset="utf-8" > > > > > > Hello, all, > > > > > > I'd like to obtain the median age for a population in a specific > > &g
[R-sig-Geo] Advice on starting to analyze smokestack emissions?
Hello, all, I'm trying to get started analyzing the concentrations of smokestack emissions. I don't have any professional background or training for this; I'm just an old, retired guy who thinks playing with numbers is fun. A local funeral home in my neighborhood (less than 1200 ft from my home) is proposing to construct a crematorium for human remains. I have some experience with the tidycensus package and thought it might be interesting to construct a model for the changes in concentrations of the pollutants from the smokestack and, using recorded wind speeds and directions, see which US Census blocks would be affected. I have the US Government EPA SCREEN3 output on how concentration varies with distance from the smokestack. See https://www.epa.gov/scram/air-quality-dispersion-modeling-screening-models#screen3 if curious. As a first task, I'd like to see if I can calculate similar results in R. I'm aware of the 'plume' steady-state Gaussian dispersion package, but am a little concerned that this package was last updated 11 year ago. As professionals in this field, do you have any recommendations for me on how to get started analyzing this problem? Is 'plume' still the way to go? I'm aware that there are many atmospheric dispersion models from the US EPA, but I was hoping to keep my work within R, which I'm really enjoying using and learning about. Are SCREEN3 and 'plume' comparable? Is this the best R list to ask questions about this topic? Thanks for any advice or guidance you have for me. -Kevin ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo