Tag: r
-
Relay teams vs individuals
I’ve been wondering occasionally how we should describe group actions. What determines what the group can accomplish vs the individuals acting independently? One particular example of this is a relay race vs individual runners. We could think of the task as requiring getting a token across a certain distance, the shorter the time, the better.…
-
California cities from CDTFA
At least based on the dates listed on https://lab.data.ca.gov/dataset/california-city-boundaries-and-identifiers — still says “03/24/25” — I’m guessing the city boundaries haven’t been updated yet. For a current project, I want the best boundaries available so let’s work directly with the source pointed out by the CIO, GIS: https://gis.data.ca.gov/datasets/CDTFA::city-and-county-boundary-line-changes/explore?layer=0&location=33.924386%2C-118.008294%2C11.67. > library(sf)> d <- read_sf(“~/Downloads/City_and_County_Boundary_Line_Changes_217120214122415134.gpkg”) It turns out…
-
A hole in Los Altos (continued)
The city clerk got back to me this morning. (Thanks much for the prompt response!) The hole in the map is also a hole in the ground — a reservoir belonging to the City of Mountain View. We happened to be in the area after checking out Tom’s Depot Cafe yesterday so I snapped a…
-
A hole in Los Altos
Looking at the Census page for Los Altos, something funny caught my eye: there’s a hole in the map for Los Altos: https://data.census.gov/profile/Los_Altos_city,_California?g=160XX00US0643280 Returning to the data from https://lab.data.ca.gov/dataset/california-city-boundaries-and-identifiers, we see the same thing: > library(ggplot2)> library(sf)> cities <- read_sf(“~/Downloads/California_Cities_and_Identifiers_Blue_Version_view_-6943741225906831761.gpkg”)> losAltos <- subset(cities, CDTFA_CITY == “Los Altos”)> ggplot(losAltos) + geom_sf() What’s in that hole? >…
-
What Wittier Whittier
I was really impressed to get an almost immediate reply from the CIO, GIS to my note about Whittier appearing to some extra stuff in the geometries provided here: https://lab.data.ca.gov/dataset/california-city-boundaries-and-identifiers. They pointed to the California Department of Tax and Fee Administration as the original source of the geometries, which has been updated in the meantime:…
-
California cities (continued)
Let’s get back roughly to where we were with the R session from California cities, reading in a copy of the data pulled from Wikipedia. > library(dplyr)> library(fillpattern)> library(sf)> library(ggplot2)> cities <- read_sf(“~/Downloads/California_Cities_and_Identifiers_Blue_Version_view_-6943741225906831761.gpkg”)> stats <- read.csv(url(“https://raw.githubusercontent.com/fadend/ca_cities_data/refs/heads/main/ca_cities.csv”), stringsAsFactors=FALSE) Oops. There’s some disagreement on names: > setdiff(stats$city_name, cities$city_name)[1] “Angels Camp” “California City” “City of Industry”> setdiff(cities$city_name, stats$city_name)[1]…
-
California cities
Here’s something fun: boundaries for cities in California: https://lab.data.ca.gov/dataset/california-city-boundaries-and-identifiers. Working with this in R: > library(sf)> cities <- read_sf(“~/Downloads/California_Cities_and_Identifiers_Blue_Version_view_-6943741225906831761.gpkg”) There are a few columns with the city names; “CENSUS_PLACE_NAME” and “CDTFA_CITY” (CA Department of Tax and Fee Administration?) agree so let’s just use “CDTFA_CITY” > sum(cities$CENSUS_PLACE_NAME != cities$CDTFA_CITY)[1] 0 It’s nice to see that there…
-
Non-unique species names
If you’re given a species name of the form genus + specific epithet, does it uniquely identify a particular species level taxon? Nope. In R, playing again with taxa.csv from https://www.inaturalist.org/taxa/inaturalist-taxonomy.dwca.zip, provided by iNaturalist: (This reminded me of an old conversation I had on r-sig-mac: https://stat.ethz.ch/pipermail/r-sig-mac/2008-September/005304.html.) Extracting the non-unique species: Here’s a spreadsheet with the…
-
Percent of Iowans in county with OB Unit
Following up on my previous post, Obstetrical care in Iowa, I was curious what percentage of Iowans are in a county with an OB Unit. We can get this pretty easily using the handy usdata R package in combination with the data we extracted previously. With this preamble, now we can take a weighted mean…
-
Obstetrical care in Iowa
The third article in Kalen McCain’s excellent series on maternal healthcare in southeastern Iowa, Barriers aren’t limited to birthdays, features a map from numbered page 14 of ACCESS TO OBSTETRICAL CARE IN IOWA: A REPORT to the IOWA STATE LEGISLATURE – CALENDAR YEAR 2021 [PDF]. This got me wondering what it would take to reproduce…