Skip to content

Commit 6b40594

Browse files
committed
add data and closes #466
1 parent f1222e5 commit 6b40594

File tree

9 files changed

+19447
-1
lines changed

9 files changed

+19447
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ Need a **reminder**? There are [extensions](https://chrome.google.com/webstore/d
166166
| 42 | `2022-10-18` | [Stranger things dialogue](data/2022/2022-10-18) | [8flix.com](https://8flix.com/stranger-things/) | [freeCodeCamp](https://www.freecodecamp.org/news/a-statistical-curiosity-voyage-through-the-emotion-of-stranger-things-e7bc8b2a6395) & ['stringr things'](https://github.com/filmicaesthetic/stringr-things) |
167167
| 43 | `2022-10-25` | [Great British Bakeoff](data/2022/2022-10-25) | [bakeoff pkg](https://bakeoff.netlify.app/) | [Data Visualization in the Tidyverse - The Great Tidy Plot Off](https://alison.netlify.app/uo-tidy-bakeoff/#1) |
168168
| 44 | `2022-11-01` | [Horror Movies](data/2022/2022-11-01) | [The Movie Database](https://www.themoviedb.org/) | [Tanya Shapiro's Horror Movies](https://github.com/tashapiro/horror-movies) |
169+
| 45 | `2022-11-08` | [Radio Stations](data/2022/2022-11-08) | [Wikipedia](https://en.wikipedia.org/wiki/Lists_of_radio_stations_in_the_United_States) | [Visualizing the Geography of FM Radio](https://erdavis.com/2020/01/04/visualizing-the-geography-of-fm-radio/) |
169170

170171
***
171172

62.2 MB
Binary file not shown.

data/2022/2022-11-08/pic1.png

4.66 MB
Loading

data/2022/2022-11-08/pic2.png

279 KB
Loading

data/2022/2022-11-08/readme.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
### Please add alt text to your posts
2+
3+
Please add alt text (alternative text) to all of your posted graphics for `#TidyTuesday`.
4+
5+
Twitter provides [guidelines](https://help.twitter.com/en/using-twitter/picture-descriptions) for how to add alt text to your images.
6+
7+
The DataViz Society/Nightingale by way of Amy Cesal has an [article](https://medium.com/nightingale/writing-alt-text-for-data-visualization-2a218ef43f81) on writing _good_ alt text for plots/graphs.
8+
9+
> Here’s a simple formula for writing alt text for data visualization:
10+
> ### Chart type
11+
> It’s helpful for people with partial sight to know what chart type it is and gives context for understanding the rest of the visual.
12+
> Example: Line graph
13+
> ### Type of data
14+
> What data is included in the chart? The x and y axis labels may help you figure this out.
15+
> Example: number of bananas sold per day in the last year
16+
> ### Reason for including the chart
17+
> Think about why you’re including this visual. What does it show that’s meaningful. There should be a point to every visual and you should tell people what to look for.
18+
> Example: the winter months have more banana sales
19+
> ### Link to data or source
20+
> Don’t include this in your alt text, but it should be included somewhere in the surrounding text. People should be able to click on a link to view the source data or dig further into the visual. This provides transparency about your source and lets people explore the data.
21+
> Example: Data from the USDA
22+
23+
Penn State has an [article](https://accessibility.psu.edu/images/charts/) on writing alt text descriptions for charts and tables.
24+
25+
> Charts, graphs and maps use visuals to convey complex images to users. But since they are images, these media provide serious accessibility issues to colorblind users and users of screen readers. See the [examples on this page](https://accessibility.psu.edu/images/charts/) for details on how to make charts more accessible.
26+
27+
The `{rtweet}` package includes the [ability to post tweets](https://docs.ropensci.org/rtweet/reference/post_tweet.html) with alt text programatically.
28+
29+
Need a **reminder**? There are [extensions](https://chrome.google.com/webstore/detail/twitter-required-alt-text/fpjlpckbikddocimpfcgaldjghimjiik/related) that force you to remember to add Alt Text to Tweets with media.
30+
31+
# Radio Stations
32+
33+
The data this week comes from [Wikipedia](https://en.wikipedia.org/wiki/Lists_of_radio_stations_in_the_United_States).
34+
35+
The dataset included was mined from all 50 states, tidying column names, binding and aggregating.
36+
37+
[Erin's](https://twitter.com/erindataviz) blogpost on [Visualizing the Geography of FM Radio](https://erdavis.com/2020/01/04/visualizing-the-geography-of-fm-radio/). Data sourced from [FCC](https://www.fcc.gov/media/radio/fm-service-contour-data-points).
38+
39+
Credit: [Frank Hull](twitter.com/frankiethull)
40+
41+
### Get the data here
42+
43+
```{r}
44+
# Get the Data
45+
46+
# Read in with tidytuesdayR package
47+
# Install from CRAN via: install.packages("tidytuesdayR")
48+
# This loads the readme and all the datasets for the week of interest
49+
50+
# Either ISO-8601 date or year/week works!
51+
52+
tuesdata <- tidytuesdayR::tt_load('2022-11-08')
53+
tuesdata <- tidytuesdayR::tt_load(2022, week = 45)
54+
55+
state_stations <- tuesdata$state_stations
56+
57+
# Or read in the data manually
58+
59+
state_stations <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-11-08/state_stations.csv')
60+
61+
```
62+
### Data Dictionary
63+
64+
# `state_stations.csv`
65+
66+
|variable |class |description |
67+
|:---------|:---------|:-----------|
68+
|call_sign |character | Call Sign |
69+
|frequency |character |frequency |
70+
|city |character |city |
71+
|licensee |character |licensee |
72+
|format |character | format |
73+
|state |character | state |
74+
75+
# `fm_service_contour_current.zip`
76+
77+
A large Zip file (~200 Mb on disk when unzipped) - see cleaning script for use.
78+
79+
|variable |class |description |
80+
|:------------------|:---------|:------------------|
81+
|application_id |character |application_id |
82+
|service |character |service |
83+
|lms_application_id |character |lms_application_id |
84+
|dts_site_number |character |dts_site_number |
85+
|site_lat |double | Site of station latitude |
86+
|site_long |double | Site of station longitude |
87+
|angle |integer | angle (0 to 360) |
88+
|deg_lat |double | Latitude for angle |
89+
|deg_lng |double | Longitude for angle |
90+
91+
# `station_info.csv`
92+
93+
Can be joined:
94+
95+
```r
96+
state_stations |> dplyr::right_join(station_info, by = c("call_sign"))
97+
```
98+
99+
|variable |class |description |
100+
|:--------|:---------|:-----------|
101+
|Call |character |Call |
102+
|Sign |double |Sign |
103+
|Facility |character |Facility |
104+
|Id |character |Id |
105+
|Service |character |Service |
106+
|Licensee |character |Licensee |
107+
|Status |character |Status |
108+
|Details |character |Details |
109+
110+
### Cleaning Script
111+
112+
```r
113+
library(purrr)
114+
library(dplyr)
115+
library(tidyr)
116+
library(ggplot2)
117+
library(stringr)
118+
library(janitor)
119+
library(rvest)
120+
121+
122+
all_states <- datasets::state.name
123+
all_states <- gsub(" ", "_", all_states)
124+
125+
126+
get_stations <- function(state){
127+
128+
root <- paste0("https://en.wikipedia.org/wiki/List_of_radio_stations_in_", state)
129+
tables <- read_html(root) %>% html_nodes("table")
130+
stations <- tables[1] %>% # ideally all pages will have same format
131+
html_table(header = TRUE) %>%
132+
do.call(rbind, .) %>%
133+
clean_names() %>%
134+
mutate(frequency = as.character(frequency)) %>% # handling Ohio special case (frequency / band split)
135+
rename_if(startsWith(names(.), "city"), ~ ("city")) %>% # handling naming issues, citation handler
136+
rename_at(vars(matches("format")), ~ "format") %>% # handling naming issues, Oklahoma handler
137+
rename_if(startsWith(names(.), "licensee"), ~ ("licensee")) %>% # handling naming issues, citation handler
138+
rename_if(startsWith(names(.), "owner"), ~ ("licensee")) %>% # South Dakota handler
139+
select(call_sign, frequency, city, licensee, format) %>%
140+
mutate(
141+
state = state
142+
)
143+
144+
return(stations)
145+
}
146+
147+
state_stations <- map_dfr(all_states, get_stations)
148+
149+
150+
```
151+
152+
For the Contour cleaning:
153+
154+
```r
155+
library(tidyverse)
156+
157+
raw_contour <- read_delim(
158+
"2022/2022-11-08/FM_service_contour_current.txt",
159+
delim = "|"
160+
)
161+
162+
conv_contour <- raw_contour |>
163+
select(-last_col()) |>
164+
set_names(nm = c(
165+
"application_id", "service", "lms_application_id", "dts_site_number", "transmitter_site",
166+
glue::glue("deg_{0:360}")
167+
))
168+
169+
lng_contour <- conv_contour |>
170+
separate(
171+
transmitter_site,
172+
into = c("site_lat", "site_long"),
173+
sep = " ,") |>
174+
pivot_longer(
175+
names_to = "angle",
176+
values_to = "values",
177+
cols = deg_0:deg_360
178+
) |>
179+
mutate(
180+
angle = str_remove(angle, "deg_"),
181+
angle = as.integer(angle)
182+
) |>
183+
separate(
184+
values,
185+
into = c("deg_lat", "deg_lng"),
186+
sep = " ,"
187+
)
188+
189+
```

0 commit comments

Comments
 (0)