Notes on Programming or Whatever

R, sports, and maybe cooking

Abortion Trigger Bans

on June 26, 2022

A colleague asked me about making an overlay map, and we discussed staring with the following information: US states where conference funding may be inhibited by AB 1887 US states where trigger bans took (or are in process) effect when Roe v Wade was overturned # load shape files states_shp <- st_read("cb_2018_us_state_5m/cb_2018_us_state_5m.shp") ## Reading layer `cb_2018_us_state_5m' from data source ## `C:\Users\freex\Documents\GitHub\blogdown\content\blog\2022-06-26-abortion-trigger-bans\cb_2018_us_state_5m\cb_2018_us_state_5m.shp' ## using driver `ESRI Shapefile' ## Simple feature collection with 56 features and 9 fields ## Geometry type: MULTIPOLYGON ## Dimension: XY ## Bounding box: xmin: -179.

Continue reading

Gauges

on June 15, 2022

Gauges are useful when wanting to display a quantity along with its range (minimum and maximum). Here, we will try out the plotly package’s functionality to build a gauge plot. library("plotly") library("tidyverse") # https://plotly.com/r/gauge-charts/ # https://marketing.ucmerced.edu/resources/brand-guidelines/colors my_gauge <- plot_ly( domain = list(x = c(0, 1), y = c(0, 1)), value = 6.35, title = list(text = "Overall Teaching Evaluation Score", color = "#002856", font = list(size = 24)), type = "indicator", mode = "gauge+number", gauge = list( axis = list(range = list(NULL, 7.

Continue reading

Drought Conditions

on June 14, 2022

“The data this week comes from the National Integrated Drought Information System.” # load raw data # drought <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-06-14/drought.csv') # drought_fips <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-06-14/drought-fips.csv') # focus on subset of data # https://www.weather.gov/hnx/cafips # merced_df <- drought_fips |> # filter(FIPS == "06047") # since original data was a fairly large data file, let's # save a copy here to ease work # write_csv(merced_df, "merced_drought.csv") df_raw <- read_csv("merced_drought.csv") ## Rows: 1171 Columns: 4 ## ── Column specification ──────────────────────────────────────────────────────── ## Delimiter: "," ## chr (2): State, FIPS ## dbl (1): DSCI ## date (1): date ## ## ℹ Use `spec()` to retrieve the full column specification for this data.

Continue reading

Bookdown and GitHub Pages

on June 12, 2022

Today I finally got a bookdown book to appear properly in GitHub pages (well, perhaps I did this in the past, but I do not recall). The main gap was that I needed to add the following line output_dir: docs to the _bookdown.yml file. Of course, the GitHub repository and Pages needed to be set up as well to point to the docs subdirectory. Here were the helpful websites

Continue reading