Quantcast
Channel: r software hub
Viewing all articles
Browse latest Browse all 1015

52Vis Week #3 – Waste Not, Want Not

$
0
0

By hrbrmstr

:-)
library(albersusa) # devtools::install_github("hrbrmstr/hrbrmisc")
library(rgeos)
library(maptools)
library(ggplot2)
library(ggalt)
library(ggthemes)
library(jsonlite)
library(tidyr)
library(dplyr)
library(purrr)

#' WSJ Waste Lands: http://projects.wsj.com/waste-lands/
#' Data from: http://www.lm.doe.gov/default.aspx?id=2602 &
#' http://www.cdc.gov/niosh/ocas/ocasawe.html

sites fromJSON("sites.json", flatten=TRUE)

#' need to replace the 0-length data.frames with at least one row of `NA`s
#' so we can safely `unnest()` them later

sites$locations map(sites$locations, function(x) {
if (nrow(x) == 0) {
data_frame(latitude=NA, longitude=NA, postal_code=NA, name=NA, street_address=NA)
} else {
x
}
})

#' we'll need this later

sites$site.rating factor(sites$site.rating,
levels=c(3:0),
labels=c("Remote or no potential for radioactive contamination, based on criteria at the time of FUSRAP review.",
"Referred to another agency or program, no authority to clean up under FUSRAP, or status unclear.",
"Cleanup declared complete under FUSRAP.",
"Cleanup in progress under the Formerly Utilized Sites Remedial Action Program (FUSRAP)."))

#' One teensy discrepancy:

nrow(sites)

#' ## ...read more

Source:: r-bloggers.com


Viewing all articles
Browse latest Browse all 1015

Trending Articles