

{"id":833,"date":"2012-03-04T23:53:14","date_gmt":"2012-03-05T04:53:14","guid":{"rendered":"http:\/\/rud.is\/b\/?p=833"},"modified":"2017-03-27T09:40:25","modified_gmt":"2017-03-27T14:40:25","slug":"thinkstats-in-r-including-example-1-2","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/","title":{"rendered":"ThinkStats \u2026 in R (including Example 1.2)"},"content":{"rendered":"<p><a href=\"https:\/\/www.amazon.com\/gp\/product\/1449307116?ie=UTF8&amp;tag=rudisdotnet-20&amp;linkCode=shr&amp;camp=213733&amp;creative=393185&amp;creativeASIN=1449307116\">ThinkStats<\/a> (by Allen B. Downey) is a good book to get you familiar with statistics (and even <a href=\"https:\/\/www.python.org\/\">Python<\/a>, if you&#8217;ve done some scripting in other languages).<\/p>\n<p>I thought it would be interesting to present some of the examples &#038; exercises in the book in <a href=\"https:\/\/www.r-project.org\/\">R<\/a>. Why? Well, once you&#8217;ve gone through the material in a particular chapter the &#8220;hard way&#8221;, seeing how you&#8217;d do the same thing in a language specifically designed for statistical computing should show when it&#8217;s best to use such a <a href=\"https:\/\/martinfowler.com\/tags\/domain%20specific%20language.html\">domain specific language<\/a> and when you might want to consider a hybrid approach. I am also hoping it helps make R a bit more accessible to folks.<\/p>\n<p>You&#8217;ll still need the book and should work through the Python examples to get the most out of these posts.<\/p>\n<p>I&#8217;ll try to get at least one example\/exercise section up a week.<\/p>\n<p>Please submit all errors, omissions or optimizations in the comments section.<\/p>\n<p>The star of the show is going to be the &#8220;<span class=\"removed_link\" title=\"http:\/\/msenux.redwoods.edu\/math\/R\/dataframe.php\">data frame<\/span>&#8221; in most of the examples (and is in this one). Unlike the Python code in the book, most of the hard work here is figuring out how to use the data frame file reader to parse the ugly fields in the CDC data file. By using some tricks, we can approximate the &#8220;field start:length&#8221; style of the Python code but still keep the automatic reading\/parsing of the R code (including implicit handling of &#8220;NA&#8221; values).<\/p>\n<p>The power &#038; simplicity of using R&#8217;s inherent ability to apply a calculation across a whole column (<code>pregnancies$agepreg <- pregnancies$agepreg \/ 100<\/code>) should jump out. Unfortunately, not all elements of the examples in R will be as nice or straightforward. <\/p>\n<p>You'll also notice that I cheat and use <code>str()<\/code> for displaying summary data.<\/p>\n<p>Enough explanation! Here's the code:<\/p>\n<pre lang=\"rsplus\" line=\"1\"># ThinkStats in R by @hrbrmstr\r\n# Example 1.2\r\n# File format info: http:\/\/www.cdc.gov\/nchs\/nsfg\/nsfg_cycle6.htm\r\n\r\n# setup a data frame that has the field start\/end info\r\n\r\npFields <- data.frame(name  = c('caseid', 'nbrnaliv', 'babysex', 'birthwgt_lb','birthwgt_oz','prglength', 'outcome', 'birthord',  'agepreg',  'finalwgt'), \r\n                      begin = c(1, 22, 56, 57, 59, 275, 277, 278, 284, 423), \r\n                      end   = c(12, 22, 56, 58, 60, 276, 277, 279, 287, 440) \r\n) \r\n\r\n# calculate widths so we can pass them to read.fwf()\r\n\r\npFields$width <- pFields$end - pFields$begin + 1 \r\n\r\n# we aren't reading every field (for the book exercises)\r\n\r\npFields$skip <-  (-c(pFields$begin[-1]-pFields$end[-nrow(pFields)]-1,0)) \r\n\r\nwidths <- c(t(pFields[,4:5])) \r\nwidths <- widths[widths!=0] \r\n\r\n# read in the file\r\n\r\npregnancies <- read.fwf(\"2002FemPreg.dat\", widths) \r\n\r\n# assign column names\r\n\r\nnames(pregnancies) <- pFields$name \r\n\r\n# divide mother's age by 100\r\n\r\npregnancies$agepreg <- pregnancies$agepreg \/ 100\r\n\r\n# convert weight at birth from lbs\/oz to total ounces\r\n\r\npregnancies$totalwgt_oz = pregnancies$birthwgt_lb * 16 + pregnancies$birthwgt_oz\r\n\r\nrFields <- data.frame(name  = c('caseid'), \r\n                      begin = c(1), \r\n                      end   = c(12) \r\n) \r\n\r\nrFields$width <- rFields$end - rFields$begin + 1 \r\nrFields$skip <-  (-c(rFields$begin[-1]-rFields$end[-nrow(rFields)]-1,0)) \r\n\r\nwidths <- c(t(rFields[,4:5])) \r\nwidths <- widths[widths!=0] \r\n\r\nrespondents <- read.fwf(\"2002FemResp.dat\", widths) \r\nnames(respondents) <- rFields$name\r\n\r\nstr(respondents)\r\nstr(pregnancies)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>ThinkStats (by Allen B. Downey) is a good book to get you familiar with statistics (and even Python, if you&#8217;ve done some scripting in other languages). I thought it would be interesting to present some of the examples &#038; exercises in the book in R. Why? Well, once you&#8217;ve gone through the material in a [&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":true,"_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":[91],"tags":[634,639,637,636,635,638,45,748,142,633,632],"class_list":["post-833","post","type-post","status-publish","format-standard","hentry","category-r","tag-allen-b-downey","tag-compiler-theory","tag-help","tag-len","tag-parsing","tag-program-optimization","tag-python","tag-r","tag-scripting-languages","tag-statistical-computing","tag-the-star"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ThinkStats \u2026 in R (including Example 1.2) - 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\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ThinkStats \u2026 in R (including Example 1.2) - rud.is\" \/>\n<meta property=\"og:description\" content=\"ThinkStats (by Allen B. Downey) is a good book to get you familiar with statistics (and even Python, if you&#8217;ve done some scripting in other languages). I thought it would be interesting to present some of the examples &#038; exercises in the book in R. Why? Well, once you&#8217;ve gone through the material in a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2012-03-05T04:53:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-03-27T14:40:25+00:00\" \/>\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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"ThinkStats \u2026 in R (including Example 1.2)\",\"datePublished\":\"2012-03-05T04:53:14+00:00\",\"dateModified\":\"2017-03-27T14:40:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/\"},\"wordCount\":308,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"keywords\":[\"Allen B. Downey\",\"Compiler theory\",\"Help\",\"Len\",\"Parsing\",\"Program optimization\",\"python\",\"R\",\"Scripting languages\",\"statistical computing\",\"The star\"],\"articleSection\":[\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/\",\"url\":\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/\",\"name\":\"ThinkStats \u2026 in R (including Example 1.2) - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"datePublished\":\"2012-03-05T04:53:14+00:00\",\"dateModified\":\"2017-03-27T14:40:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ThinkStats \u2026 in R (including Example 1.2)\"}]},{\"@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":"ThinkStats \u2026 in R (including Example 1.2) - 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\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/","og_locale":"en_US","og_type":"article","og_title":"ThinkStats \u2026 in R (including Example 1.2) - rud.is","og_description":"ThinkStats (by Allen B. Downey) is a good book to get you familiar with statistics (and even Python, if you&#8217;ve done some scripting in other languages). I thought it would be interesting to present some of the examples &#038; exercises in the book in R. Why? Well, once you&#8217;ve gone through the material in a [&hellip;]","og_url":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/","og_site_name":"rud.is","article_published_time":"2012-03-05T04:53:14+00:00","article_modified_time":"2017-03-27T14:40:25+00:00","author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"ThinkStats \u2026 in R (including Example 1.2)","datePublished":"2012-03-05T04:53:14+00:00","dateModified":"2017-03-27T14:40:25+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/"},"wordCount":308,"commentCount":0,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"keywords":["Allen B. Downey","Compiler theory","Help","Len","Parsing","Program optimization","python","R","Scripting languages","statistical computing","The star"],"articleSection":["R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/","url":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/","name":"ThinkStats \u2026 in R (including Example 1.2) - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"datePublished":"2012-03-05T04:53:14+00:00","dateModified":"2017-03-27T14:40:25+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2012\/03\/04\/thinkstats-in-r-including-example-1-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"ThinkStats \u2026 in R (including Example 1.2)"}]},{"@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-dr","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":12586,"url":"https:\/\/rud.is\/b\/2020\/01\/01\/writing-frictionless-r-package-wrappers-introduction\/","url_meta":{"origin":833,"position":0},"title":"Writing Frictionless R Package Wrappers \u2014 Introduction","author":"hrbrmstr","date":"2020-01-01","format":false,"excerpt":"The R language and RStudio IDE are a powerful combination for \"getting stuff done\", and one aspect of R itself that makes it especially useful is the ability to use it with other programming languages via a robust foreign language interface capability1. The term \"foreign language\" refers to another programming\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4154,"url":"https:\/\/rud.is\/b\/2016\/03\/18\/stacking-the-deck-against-treemaps\/","url_meta":{"origin":833,"position":1},"title":"Stacking the deck against treemaps","author":"hrbrmstr","date":"2016-03-18","format":false,"excerpt":"So, I (unapologetically) did this to @Highcharts last week: @hrbrmstr Your loss of words inspired this post!! https:\/\/t.co\/3KO0BP0k0u @hadleywickham @ma_salmon @tdmv @bearloga @rushworth_a @awhstin\u2014 Highcharts (@Highcharts) March 18, 2016 They did an awesome makeover (it's interactive if you follow the link): And, I'm not kidding, it's actually a really good\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\/RStudioScreenSnapz021.png?fit=1200%2C695&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/RStudioScreenSnapz021.png?fit=1200%2C695&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/RStudioScreenSnapz021.png?fit=1200%2C695&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/RStudioScreenSnapz021.png?fit=1200%2C695&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/RStudioScreenSnapz021.png?fit=1200%2C695&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6146,"url":"https:\/\/rud.is\/b\/2017\/08\/01\/r%e2%81%b6-reticulating-parquet-files\/","url_meta":{"origin":833,"position":2},"title":"R\u2076 \u2014 Reticulating Parquet Files","author":"hrbrmstr","date":"2017-08-01","format":false,"excerpt":"The reticulate package provides a very clean & concise interface bridge between R and Python which makes it handy to work with modules that have yet to be ported to R (going native is always better when you can do it). This post shows how to use reticulate to create\u2026","rel":"","context":"In &quot;data wrangling&quot;","block_context":{"text":"data wrangling","link":"https:\/\/rud.is\/b\/category\/data-wrangling\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11077,"url":"https:\/\/rud.is\/b\/2018\/07\/20\/a-new-boto3-amazon-athena-client-wrapper-with-dplyr-async-query-support\/","url_meta":{"origin":833,"position":3},"title":"A new &#8216;boto3&#8217; Amazon Athena client wrapper with dplyr async query support","author":"hrbrmstr","date":"2018-07-20","format":false,"excerpt":"A previous post explored how to deal with Amazon Athena queries asynchronously. The function presented is a beast, though it is on purpose (to provide options for folks). In reality, nobody really wants to use rJava wrappers much anymore and dealing with icky Python library calls directly just feels wrong,\u2026","rel":"","context":"In &quot;athena&quot;","block_context":{"text":"athena","link":"https:\/\/rud.is\/b\/category\/athena\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5004,"url":"https:\/\/rud.is\/b\/2017\/02\/09\/diving-into-dynamic-website-content-with-splashr\/","url_meta":{"origin":833,"position":4},"title":"Diving Into Dynamic Website Content with splashr","author":"hrbrmstr","date":"2017-02-09","format":false,"excerpt":"If you do enough web scraping, you'll eventually hit a wall that the trusty httr verbs (that sit beneath rvest) cannot really overcome: dynamically created content (via javascript) on a site. If the site was nice enough to use XHR requests to load the dynamic content, you can generally still\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12447,"url":"https:\/\/rud.is\/b\/2019\/08\/23\/polyglot-fizzbuzz-in-r-plus-why-cant-johnny-code\/","url_meta":{"origin":833,"position":5},"title":"Polyglot FizzBuzz in R (Plus: &#8220;Why Can&#8217;t Johnny Code?&#8221;)","author":"hrbrmstr","date":"2019-08-23","format":false,"excerpt":"I caught this post on the The Surprising Number Of Programmers Who Can\u2019t Program from the Hacker News RSS feed. Said post links to another, classic post on the same subject and you should read both before continuing. Back? Great! Let's dig in. Why does hrbrmstr care about this? Offspring\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/rud.is\/b\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/833","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=833"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/833\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}