

{"id":3094,"date":"2014-10-13T16:28:08","date_gmt":"2014-10-13T21:28:08","guid":{"rendered":"http:\/\/rud.is\/b\/?p=3094"},"modified":"2018-03-07T16:44:24","modified_gmt":"2018-03-07T21:44:24","slug":"spending-seized-assets-a-state-by-state-per-capita-comparison-in-r","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/","title":{"rendered":"Spending Seized Assets &#8211; A State-by-State Per-capita Comparison in R"},"content":{"rendered":"<p>The Washingon Post did another great story+vis, this time on states [Spending seized assets](http:\/\/www.washingtonpost.com\/wp-srv\/special\/investigative\/asset-seizures\/).<\/p>\n<p>According to their sub-head:<\/p>\n<p>>_Since 2008, about 5,400 police agencies have spent $2.5 billion in proceeds from cash and property seized under federal civil forfeiture laws. Police suspected the assets were linked to crime, although in 81 percent of cases no one was indicted._<\/p>\n<p>Their interactive visualization lets you drill down into each state to examine the spending in each category. Since the WaPo team made the [data available](http:\/\/www.washingtonpost.com\/wp-srv\/special\/investigative\/asset-seizures\/data\/all.json) [JSON] I thought it might be interesting to take a look at a comparison across states (i.e. who are the &#8220;big spenders&#8221; of this siezed hoarde). Here&#8217;s a snippet of the JSON:<\/p>\n<pre lang=\"json\">{\"states\": [\r\n  {\r\n  \"st\": \"AK\",\r\n  \"stn\": \"Alaska\",\r\n  \"total\": 8470032,\r\n  \"cats\":\r\n     [{ \"weapons\": 1649832, \r\n     \"electronicSurv\": 402490, \r\n     \"infoRewards\": 760730, \r\n     \"travTrain\": 848128, \r\n     \"commPrograms\": 121664, \r\n     \"salaryOvertime\": 776766, \r\n     \"other\": 1487613, \r\n     \"commComp\": 1288439, \r\n     \"buildImprov\": 1134370 }],\r\n  \"agencies\": [\r\n     {\r\n     \"aid\": \"AK0012700\",\r\n     \"aname\": \"Airport Police & Fire Ted Stevens Anch Int'L Arpt\",\r\n     \"total\": 611553,\r\n     \"cats\":\r\n        [{ \"weapons\": 214296, \"travTrain\": 44467, \"other\": 215464, \"commComp\": 127308, \"buildImprov\": 10019 }]\r\n     },\r\n     {\r\n     \"aid\": \"AK0010100\",\r\n     \"aname\": \"Anchorage Police Department\",\r\n     \"total\": 3961497,\r\n     \"cats\":\r\n        [{ \"weapons\": 1104777, \"electronicSurv\": 94741, \"infoRewards\": 743230, \"travTrain\": 409474, \"salaryOvertime\": 770709, \"other\": 395317, \"commComp\": 249220, \"buildImprov\": 194029 }]\r\n     },<\/pre>\n<p>Getting the data was easy (in R, of course!). Let&#8217;s setup the packages we&#8217;ll need:<\/p>\n<pre lang=\"rsplus\">library(data.table)\r\nlibrary(dplyr)\r\nlibrary(tidyr)\r\nlibrary(ggplot2)\r\nlibrary(scales)\r\nlibrary(grid)\r\nlibrary(statebins)\r\nlibrary(gridExtra)<\/pre>\n<p>We also need `jsonlite`, but only to parse the data (which I&#8217;ve downloaded locally), so we&#8217;ll just do that in one standalone line:<\/p>\n<pre lang=\"rsplus\">data <- jsonlite::fromJSON(\"all.json\", simplifyVector=FALSE)<\/pre>\n<p>It's not fair (or valid) to just compare totals since some states have a larger population than others, so we'll show the data twice, once in raw totals and once with a per-capita lens. For that, we'll need population data:<\/p>\n<pre lang=\"rsplus\">pop <- read.csv(\"http:\/\/www.census.gov\/popest\/data\/state\/asrh\/2013\/files\/SCPRC-EST2013-18+POP-RES.csv\", stringsAsFactors=FALSE)\r\ncolnames(pop) <- c(\"sumlev\", \"region\", \"divison\", \"state\", \"stn\", \"pop2013\", \"pop18p2013\", \"pcntest18p\")\r\npop$stn <- gsub(\" of \", \" Of \", pop$stn)<\/pre>\n<p>We have to fix the `District of Columbia` since the WaPo data capitalizes the `Of`.<\/p>\n<p>Now we need to extract the agency data. This is really straightforward with some help from the `data.table` package:<\/p>\n<pre lang=\"rsplus\">agencies <- rbindlist(lapply(data$states, function(x) {\r\n  rbindlist(lapply(x$agencies, function(y) {\r\n    data.table(st=x$st, stn=x$stn, aid=y$aid, aname=y$aname, rbindlist(y$cats))\r\n  }), fill=TRUE)\r\n}), fill=TRUE)<\/pre>\n<p>The `rbindlist` `fill` option is super-handy in the event we have varying columns (and, we do in this case). It's also wicked-fast.<\/p>\n<p>Now, we use some `dplyr` and `tidyr` to integrate the population information and summarize our data (OK, we cheat and use `melt`, but some habits are hard to break):<\/p>\n<pre lang=\"rsplus\">c_st <- agencies %>%\r\n  merge(pop[,5:6], all.x=TRUE, by=\"stn\") %>%\r\n  gather(category, value, -st, -stn, -pop2013, -aid, -aname) %>%\r\n  group_by(st, category, pop2013) %>%\r\n  summarise(total=sum(value, na.rm=TRUE), per_capita=sum(value, na.rm=TRUE)\/pop2013) %>%\r\n  select(st, category, total, per_capita)<\/pre>\n<p>Let's use a series of bar charts to compare state-against state. We'll do the initial view with just raw totals. There are 9 charts, so this graphic scrolls a bit and you can select it to make it larger:<\/p>\n<pre lang=\"rsplus\"># hack to ordering the bars by kohske : http:\/\/stackoverflow.com\/a\/5414445\/1457051 #####\r\n\r\nc_st <- transform(c_st, category2=factor(paste(st, category)))\r\nc_st <- transform(c_st, category2=reorder(category2, rank(-total)))\r\n\r\n# pretty names #####\r\n\r\nlevels(c_st$category) <- c(\"Weapons\", \"Travel, training\", \"Other\",\r\n                           \"Communications, computers\", \"Building improvements\",\r\n                           \"Electronic surveillance\", \"Information, rewards\",\r\n                           \"Salary, overtime\", \"Community programs\")\r\ngg <- ggplot(c_st, aes(x=category2, y=total))\r\ngg <- gg + geom_bar(stat=\"identity\", aes(fill=category))\r\ngg <- gg + scale_y_continuous(labels=dollar)\r\ngg <- gg + scale_x_discrete(labels=c_st$st, breaks=c_st$category2)\r\ngg <- gg + facet_wrap(~category, scales = \"free\", ncol=1)\r\ngg <- gg + labs(x=\"\", y=\"\")\r\ngg <- gg + theme_bw()\r\ngg <- gg + theme(strip.background=element_blank())\r\ngg <- gg + theme(strip.text=element_text(size=15, face=\"bold\"))\r\ngg <- gg + theme(panel.margin=unit(2, \"lines\"))\r\ngg <- gg + theme(panel.border=element_blank())\r\ngg <- gg + theme(legend.position=\"none\")\r\ngg<\/pre>\n<p><center><\/p>\n<h2>Comparison of Spending Category by State (raw totals)<\/h2>\n<p><a target=_blank href=\"https:\/\/i0.wp.com\/rud.is\/dl\/raw-lg.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3098\" data-permalink=\"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/raw-sm\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?fit=630%2C859&amp;ssl=1\" data-orig-size=\"630,859\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"raw-sm\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?fit=510%2C695&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?resize=510%2C695&#038;ssl=1\" alt=\"raw-sm\" width=\"510\" height=\"695\" class=\"aligncenter size-full wp-image-3098\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?w=630&amp;ssl=1 630w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?resize=110%2C150&amp;ssl=1 110w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?resize=220%2C300&amp;ssl=1 220w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?resize=530%2C722&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?resize=535%2C729&amp;ssl=1 535w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/center><\/p>\n<p>There are definitely a few, repeating \"big spenders\" in that view, but is that the _real_ story? Let's take another look, but factoring in state population:<\/p>\n<pre lang=\"rsplus\"># change bar order to match per-capita calcuation #####\r\n\r\nc_st <- transform(c_st, category2=reorder(category2, rank(-per_capita)))\r\n\r\n# per-capita bar plot #####\r\n\r\ngg <- ggplot(c_st, aes(x=category2, y=per_capita))\r\ngg <- gg + geom_bar(stat=\"identity\", aes(fill=category))\r\ngg <- gg + scale_y_continuous(labels=dollar)\r\ngg <- gg + scale_x_discrete(labels=c_st$st, breaks=c_st$category2)\r\ngg <- gg + facet_wrap(~category, scales = \"free\", ncol=1)\r\ngg <- gg + labs(x=\"\", y=\"\")\r\ngg <- gg + theme_bw()\r\ngg <- gg + theme(strip.background=element_blank())\r\ngg <- gg + theme(strip.text=element_text(size=15, face=\"bold\"))\r\ngg <- gg + theme(panel.margin=unit(2, \"lines\"))\r\ngg <- gg + theme(panel.border=element_blank())\r\ngg <- gg + theme(legend.position=\"none\")\r\ngg<\/pre>\n<p><center><\/p>\n<h2>Comparison of Spending Category by State (per-capita)<\/h2>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/dl\/capita-lg.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3097\" data-permalink=\"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/capita-sm\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?fit=630%2C859&amp;ssl=1\" data-orig-size=\"630,859\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"capita-sm\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?fit=510%2C695&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?resize=510%2C695&#038;ssl=1\" alt=\"capita-sm\" width=\"510\" height=\"695\" class=\"aligncenter size-full wp-image-3097\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?w=630&amp;ssl=1 630w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?resize=110%2C150&amp;ssl=1 110w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?resize=220%2C300&amp;ssl=1 220w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?resize=530%2C722&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/capita-sm.png?resize=535%2C729&amp;ssl=1 535w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/center><\/p>\n<p>That certainly changes things! Alaska, West Virginia, and D.C. definitely stand out for \"Weapons\", \"Other\" & \"Information\", respectively, (what's Rhode Island hiding in \"Other\"?!) and the \"top 10\" in each category are very different from the raw total's view. We can look at this per-capita view with the `statebins` package as well:<\/p>\n<pre lang=\"rsplus\">st_pl <- vector(\"list\", 1+length(unique(c_st$category)))\r\n\r\nj <- 0\r\nfor (i in unique(c_st$category)) {\r\n  j <- j + 1\r\n  st_pl[[j]] <- statebins_continuous(c_st[category==i,], state_col=\"st\", value_col=\"per_capita\") +\r\n    scale_fill_gradientn(labels=dollar, colours=brewer.pal(6, \"PuBu\"), name=i) +\r\n    theme(legend.key.width=unit(2, \"cm\"))\r\n}\r\nst_pl[[1+length(unique(c_st$category))]] <- list(ncol=1)\r\n\r\ngrid.arrange(st_pl[[1]], st_pl[[2]], st_pl[[3]],\r\n             st_pl[[4]], st_pl[[5]], st_pl[[6]],\r\n             st_pl[[7]], st_pl[[8]], st_pl[[9]], ncol=3)<\/pre>\n<p><center><\/p>\n<h2>Per-capita \"Statebins\" view of WaPo Seizure Data<\/h2>\n<p><div style=\"width: 510px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3094-1\" width=\"510\" height=\"510\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/rud.is\/b\/wp-content\/uploads\/2014\/10\/statebins.mp4?_=1\" \/><a href=\"https:\/\/rud.is\/b\/wp-content\/uploads\/2014\/10\/statebins.mp4\">https:\/\/rud.is\/b\/wp-content\/uploads\/2014\/10\/statebins.mp4<\/a><\/video><\/div><\/center><\/p>\n<p>(Doing this exercise also showed me I need to add some flexibility to the `statebins` package).<\/p>\n<p>The <!-- Missing Gist ID -->(https:\/\/gist.github.com\/hrbrmstr\/27b8f44f573539dc2971) shows how to build a top-level category data table (along with the rest of the code in this post). I may spin this data up into an interactive D3 visualization in the next week or two (as I think it might work better than large faceted bar charts), so stay tuned!<\/p>\n<p>A huge thank you to the WaPo team for making data available to others. Go forth and poke at it with your own questions and see what you can come up with (perhaps comparing by area of state)!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Washingon Post did another great story+vis, this time on states [Spending seized assets](http:\/\/www.washingtonpost.com\/wp-srv\/special\/investigative\/asset-seizures\/). According to their sub-head: >_Since 2008, about 5,400 police agencies have spent $2.5 billion in proceeds from cash and property seized under federal civil forfeiture laws. Police suspected the assets were linked to crime, although in 81 percent of cases no [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[24,677,709,678,673,674,706,91],"tags":[810],"class_list":["post-3094","post","type-post","status-publish","format-standard","hentry","category-charts-graphs","category-data-analysis-2","category-data-driven-security","category-data-visualization","category-datavis-2","category-dataviz","category-maps","category-r","tag-post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spending Seized Assets - A State-by-State Per-capita Comparison in R - rud.is<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spending Seized Assets - A State-by-State Per-capita Comparison in R - rud.is\" \/>\n<meta property=\"og:description\" content=\"The Washingon Post did another great story+vis, this time on states [Spending seized assets](http:\/\/www.washingtonpost.com\/wp-srv\/special\/investigative\/asset-seizures\/). According to their sub-head: &gt;_Since 2008, about 5,400 police agencies have spent $2.5 billion in proceeds from cash and property seized under federal civil forfeiture laws. Police suspected the assets were linked to crime, although in 81 percent of cases no [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-13T21:28:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-07T21:44:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png\" \/>\n<meta name=\"author\" content=\"hrbrmstr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"hrbrmstr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Spending Seized Assets &#8211; A State-by-State Per-capita Comparison in R\",\"datePublished\":\"2014-10-13T21:28:08+00:00\",\"dateModified\":\"2018-03-07T21:44:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/\"},\"wordCount\":586,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2014\\\/10\\\/raw-sm.png\",\"keywords\":[\"post\"],\"articleSection\":[\"Charts &amp; Graphs\",\"Data Analysis\",\"data driven security\",\"Data Visualization\",\"DataVis\",\"DataViz\",\"maps\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/\",\"name\":\"Spending Seized Assets - A State-by-State Per-capita Comparison in R - rud.is\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2014\\\/10\\\/raw-sm.png\",\"datePublished\":\"2014-10-13T21:28:08+00:00\",\"dateModified\":\"2018-03-07T21:44:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2014\\\/10\\\/raw-sm.png?fit=630%2C859&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2014\\\/10\\\/raw-sm.png?fit=630%2C859&ssl=1\",\"width\":630,\"height\":859},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2014\\\/10\\\/13\\\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rud.is\\\/b\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spending Seized Assets &#8211; A State-by-State Per-capita Comparison in R\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/\",\"name\":\"rud.is\",\"description\":\"&quot;In God we trust. All others must bring data&quot;\",\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/rud.is\\\/b\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\",\"name\":\"hrbrmstr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"width\":460,\"height\":460,\"caption\":\"hrbrmstr\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\"},\"description\":\"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7\",\"sameAs\":[\"http:\\\/\\\/rud.is\"],\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/author\\\/hrbrmstr\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spending Seized Assets - A State-by-State Per-capita Comparison in R - rud.is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/","og_locale":"en_US","og_type":"article","og_title":"Spending Seized Assets - A State-by-State Per-capita Comparison in R - rud.is","og_description":"The Washingon Post did another great story+vis, this time on states [Spending seized assets](http:\/\/www.washingtonpost.com\/wp-srv\/special\/investigative\/asset-seizures\/). According to their sub-head: >_Since 2008, about 5,400 police agencies have spent $2.5 billion in proceeds from cash and property seized under federal civil forfeiture laws. Police suspected the assets were linked to crime, although in 81 percent of cases no [&hellip;]","og_url":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/","og_site_name":"rud.is","article_published_time":"2014-10-13T21:28:08+00:00","article_modified_time":"2018-03-07T21:44:24+00:00","og_image":[{"url":"https:\/\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png","type":"","width":"","height":""}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Spending Seized Assets &#8211; A State-by-State Per-capita Comparison in R","datePublished":"2014-10-13T21:28:08+00:00","dateModified":"2018-03-07T21:44:24+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/"},"wordCount":586,"commentCount":3,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png","keywords":["post"],"articleSection":["Charts &amp; Graphs","Data Analysis","data driven security","Data Visualization","DataVis","DataViz","maps","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/","url":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/","name":"Spending Seized Assets - A State-by-State Per-capita Comparison in R - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png","datePublished":"2014-10-13T21:28:08+00:00","dateModified":"2018-03-07T21:44:24+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?fit=630%2C859&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2014\/10\/raw-sm.png?fit=630%2C859&ssl=1","width":630,"height":859},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2014\/10\/13\/spending-seized-assets-a-state-by-state-per-capita-comparison-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Spending Seized Assets &#8211; A State-by-State Per-capita Comparison in R"}]},{"@type":"WebSite","@id":"https:\/\/rud.is\/b\/#website","url":"https:\/\/rud.is\/b\/","name":"rud.is","description":"&quot;In God we trust. All others must bring data&quot;","publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rud.is\/b\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886","name":"hrbrmstr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","width":460,"height":460,"caption":"hrbrmstr"},"logo":{"@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1"},"description":"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7","sameAs":["http:\/\/rud.is"],"url":"https:\/\/rud.is\/b\/author\/hrbrmstr\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p23idr-NU","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":123,"url":"https:\/\/rud.is\/b\/2011\/02\/14\/metricon-evidence-based-risk-management\/","url_meta":{"origin":3094,"position":0},"title":"Metricon: Evidence Based Risk Management","author":"hrbrmstr","date":"2011-02-14","format":false,"excerpt":"Better management through better measurementSpeakers: Wade Baker and Alex Hutton and Chris Porter State of the industry: are we a science or pseudoscience? random fact gathering morass of interesting, trivial, irrelevant obs variety of theories that provide little guidance to data gathering \u00a0 Sources of knowledge under \"risk\" aggregate: asset\u2026","rel":"","context":"In &quot;Information Security&quot;","block_context":{"text":"Information Security","link":"https:\/\/rud.is\/b\/category\/information-security\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3278,"url":"https:\/\/rud.is\/b\/2015\/02\/15\/introducing-the-streamgraph-htmlwidget-r-pacakge\/","url_meta":{"origin":3094,"position":1},"title":"Introducing the streamgraph htmlwidget R Package","author":"hrbrmstr","date":"2015-02-15","format":false,"excerpt":"We were looking for a different type of visualization for a project at work this past week and my thoughts immediately gravitated towards [streamgraphs](http:\/\/www.leebyron.com\/else\/streamgraph\/). The TLDR on streamgraphs is they they are generalized versions of stacked area graphs with free baselines across the x axis. They are somewhat [controversial](http:\/\/www.visualisingdata.com\/index.php\/2010\/08\/making-sense-of-streamgraphs\/) but\u2026","rel":"","context":"In &quot;d3&quot;","block_context":{"text":"d3","link":"https:\/\/rud.is\/b\/category\/d3\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3806,"url":"https:\/\/rud.is\/b\/2015\/12\/13\/fear-of-wapo-using-bad-pie-charts-has-increased-since-last-year\/","url_meta":{"origin":3094,"position":2},"title":"Fear of WaPo Using Bad Pie Charts Has Increased Since Last Year","author":"hrbrmstr","date":"2015-12-13","format":false,"excerpt":"I woke up this morning to a [headline story from the Washington Post](https:\/\/www.washingtonpost.com\/news\/the-fix\/wp\/2015\/12\/10\/to-many-christian-terrorists-arent-true-christians-but-muslim-terrorists-are-true-muslims\/) on _\"Americans are twice as willing to distance Christian extremists from their religion as Muslims_\". This post is not about the content of the headline or story. It _is_ about the horrible pie chart WaPo led the\u2026","rel":"","context":"In &quot;Data Visualization&quot;","block_context":{"text":"Data Visualization","link":"https:\/\/rud.is\/b\/category\/data-visualization\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/unnamed-chunk-1-1.png?fit=1200%2C877&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/unnamed-chunk-1-1.png?fit=1200%2C877&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/unnamed-chunk-1-1.png?fit=1200%2C877&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/unnamed-chunk-1-1.png?fit=1200%2C877&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/unnamed-chunk-1-1.png?fit=1200%2C877&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3455,"url":"https:\/\/rud.is\/b\/2015\/06\/07\/animated-us-hexbin-map-of-the-avian-flu-outbreak\/","url_meta":{"origin":3094,"position":3},"title":"Animated US Hexbin Map of the Avian Flu Outbreak","author":"hrbrmstr","date":"2015-06-07","format":false,"excerpt":"The recent announcement of the [start of egg rationing in the U.S.](http:\/\/www.washingtonpost.com\/blogs\/wonkblog\/wp\/2015\/06\/05\/the-largest-grocer-in-the-texas-is-now-rationing-eggs\/) made me curious enough about the avian flu outbreak to try to dig into the numbers a bit. I finally stumbled upon a [USDA site](http:\/\/www.aphis.usda.gov\/wps\/portal\/aphis\/ourfocus\/animalhealth\/sa_animal_disease_information\/sa_avian_health\/sa_detections_by_states\/ct_ai_pacific_flyway\/!ut\/p\/a1\/lVPBkqIwEP2WOexpCxMBAY-oo6Kybo01q3JJNSGB1GCgSNTi7zcwe3CnZnQ3h1Sl-3X369cdlKADSiRcRA5aVBLK7p14ZLVd2sMJtqPFbvyMox-_5nGw8Z3t0jWAowHgL06I_47friOvi3_Bk-VsiHcO2qMEJVTqWhfoCHUhFKGV1ExqUoq0gab9hhWQ6twQXtGz6l8gxQlKUjAodXFryYRioBgRklfNqW_i3X0RIG_xGdOMdm5F0pYoDZqZ1FQTEKQGKrighJftFdqOX01Fho7c9iiAzS3HG6WWm2HbSnmAzYXxyA3AG1L-R487Df-TntNFuHT9jVHQDWwczUywP44xjrxH8b2eDzL0gHsj-1Bk8TwxReabn_56ZeP1CB0NSf9LFmMX7f5TtdXDtmYoib9z5YadQnYTT-PcVABdWN2s0eHuDry7b3agN3y2A-jw6Q4YfnlZpeZD7Ke3REKZOoEh0jDOGtYMikppdLher4OzymCQVxdUn15PgdMK6-0lwM7obR9ayTx_evoNPxBrVg!!\/?1dmy&urile=wcm:path:\/APHIS_Content_Library\/SA_Our_Focus\/SA_Animal_Health\/SA_Animal_Disease_Information\/SA_Avian_Health\/SA_Detections_by_States\/) that had an embedded HTML table of flock outbreak statistics by state, county\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4183,"url":"https:\/\/rud.is\/b\/2016\/03\/19\/using-propublica-statefaces-in-ggplot2\/","url_meta":{"origin":3094,"position":4},"title":"Using ProPublica &#8220;statefaces&#8221; in ggplot2","author":"hrbrmstr","date":"2016-03-19","format":false,"excerpt":"UPDATE: The dev version of ggalt has a new geom_stateface() which encapsulates the tedious bits and also included the TTF font. I'm a huge fan of ProPublica. They have a super-savvy tech team, great reporters, awesome graphics folks and excel at data-driven journalism. Plus, they give away virtually everything, including\u2026","rel":"","context":"In &quot;Data Visualization&quot;","block_context":{"text":"Data Visualization","link":"https:\/\/rud.is\/b\/category\/data-visualization\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Plot_Zoom.png?fit=1200%2C921&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Plot_Zoom.png?fit=1200%2C921&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Plot_Zoom.png?fit=1200%2C921&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Plot_Zoom.png?fit=1200%2C921&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Plot_Zoom.png?fit=1200%2C921&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3841,"url":"https:\/\/rud.is\/b\/2016\/01\/03\/zellingenach-a-visual-exploration-of-the-spatial-patterns-in-the-endings-of-german-town-and-village-names-in-r\/","url_meta":{"origin":3094,"position":5},"title":"Zellingenach: A visual exploration of the spatial patterns in the endings of German town and village names in R","author":"hrbrmstr","date":"2016-01-03","format":false,"excerpt":"Moritz Stefaner started off 2016 with a [very spiffy post](http:\/\/truth-and-beauty.net\/experiments\/ach-ingen-zell\/) on _\"a visual exploration of the spatial patterns in the endings of German town and village names\"_. Moritz was [exploring some new data processing & visualization tools](https:\/\/github.com\/moritzstefaner\/ach-ingen-zell) for the post, but when I saw what he was doing I wondered\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/01\/rud_is_zellingenach_html.png?fit=597%2C798&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/01\/rud_is_zellingenach_html.png?fit=597%2C798&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/01\/rud_is_zellingenach_html.png?fit=597%2C798&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/comments?post=3094"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3094\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=3094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=3094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=3094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}