Last active
August 29, 2015 14:20
-
-
Save justgrimes/bfe5561026ddaaf27ced to your computer and use it in GitHub Desktop.
sonify public library survey data using R and audiolyzR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to load public public library data from the most recent | |
# FY 2012 Public Library Survey (PLS) from Institute of Museum and Library Services | |
# Data documentation -> http://www.imls.gov/assets/1/AssetManager/fy2012_pls_data_file_documentation.pdf | |
# More info about data & survey -> http://www.imls.gov/research/public_libraries_in_the_united_states_survey.aspx | |
install.packages("audiolyzR") | |
library("audiolyzR") | |
# Load PLS 2012 directly from the web | |
temp <- tempfile() | |
download.file("http://www.imls.gov/assets/1/AssetManager/pupld12a_csv.zip", temp, mode="wb") | |
unzip(temp, "Pupld12a.csv") #public library administrative entities (9000+); most data points are here at this level | |
unzip(temp, "Puout12a.csv") #public library outlets (17,000) | |
unzip(temp, "Pusum12a.csv") #public library state summaries | |
pupld12a <- read.csv("Pupld12a.csv", header = TRUE, sep=",", quote = "\"", na.strings=c(".","-1","-3")) | |
puout12a <- read.csv("Puout12a.csv", header = TRUE, sep=",", quote = "\"", na.strings=c(".","-1","-3")) | |
pusum12a <- read.csv("Pusum12a.csv", header = TRUE, sep=",", quote = "\"", na.strings=c(".","-1","-3")) | |
# audio scatterplot example: total income X total visits | |
audioScatter(TOTINCM ~ VISITS,data=pupld12a, purge.plots = TRUE) | |
# audio scatterplot example: total circulation of materials X total visits | |
audioScatter(TOTCIR ~ VISITS,data=pupld12a, purge.plots = TRUE) | |
# audio scatterplot example: total number of print materials X total visits | |
audioScatter(VISITS ~ BKVOL,data=pupld12a, purge.plots = TRUE) | |
#subset data for scatterplot matrix example | |
keep <- c( | |
"POPU_UND","LIBRARIA","TOTSTAFF","LOCGVT","STGVT","FEDGVT","TOTINCM", | |
"STAFFEXP","PRMATEXP","ELMATEXP","OTHMATEX","TOTEXPCO","OTHOPEXP", | |
"TOTOPEXP","BKVOL","EBOOK","HRS_OPEN","VISITS","TOTCIR" | |
) | |
pls12 <- pupld12a[keep] | |
# audio scatterplot matrix example | |
audioSplom(data=pls12, bins=20, purge.plots = TRUE) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment