

{"id":10834,"date":"2018-05-29T07:42:06","date_gmt":"2018-05-29T12:42:06","guid":{"rendered":"https:\/\/rud.is\/b\/?p=10834"},"modified":"2018-05-29T07:42:06","modified_gmt":"2018-05-29T12:42:06","slug":"the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/","title":{"rendered":"The Fix Is In: Finding infix functions inside contributed R package &#8220;utilities&#8221; files"},"content":{"rendered":"<p>Regular readers will recall the &#8220;<a href=\"https:\/\/rud.is\/b\/2018\/04\/08\/dissecting-r-package-utility-belts\/\">utility belt<\/a>&#8221; post from back in April of this year. This is a follow-up to a request made asking for a list of all the <code>%<\/code> infix functions in those files.<\/p>\n<p>We&#8217;re going to:<\/p>\n<ul>\n<li>collect up all of the sources<\/li>\n<li>parse them<\/li>\n<li>find all the definitions of <code>%<\/code> infix functions<\/li>\n<li>write them to a file<\/li>\n<\/ul>\n<p>We&#8217;ll start by grabbing the data from the previous post and look at it as a refresher:<\/p>\n<pre><code class=\"language-r\">\nlibrary(stringi)\nlibrary(tidyverse)\n\nutils <- read_rds(url(\"https:\/\/rud.is\/dl\/utility-belt.rds\"))\n\nutils\n## # A tibble: 1,746 x 13\n##    permsissions links owner     group      size month day   year_hr path   date       pkg   fil   file_src             \n##  1 -rw-r--r--       0 hornik    users      1658 Jun   05    2016    AHR\/R\u2026 2016-06-05 AHR   util\u2026 \"## \\\\int f(x)dg(x) \u2026\n##  2 -rw-r--r--       0 ligges    users     12609 Dec   13    2016    ALA4R\u2026 2016-12-13 ALA4R util\u2026 \"## some utility fun\u2026\n##  3 -rw-r--r--       0 hornik    users         0 Feb   24    2017    AWR.K\u2026 2017-02-24 AWR.\u2026 util\u2026 \"\"                   \n##  4 -rw-r--r--       0 ligges    users      4127 Aug   30    2017    Alpha\u2026 2017-08-30 Alph\u2026 util\u2026 \"#\\n#' Assign API ke\u2026\n##  5 -rw-r--r--       0 ligges    users       121 Jan   19    2017    Amylo\u2026 2017-01-19 Amyl\u2026 util\u2026 \"make_decision <- fu\u2026\n##  6 -rw-r--r--       0 herbrandt herbrandt    52 Aug   10    2017    BANES\u2026 2017-08-10 BANE\u2026 util\u2026 \"#' @importFrom dply\u2026\n##  7 -rw-r--r--       0 ripley    users     36977 Jan   06    2015    BEQI2\u2026 2015-01-06 BEQI2 util\u2026 \"#' \\tRemove Redunda\u2026\n##  8 -rw-r--r--       0 hornik    users     34198 May   10    2017    BGDat\u2026 2017-05-10 BGDa\u2026 util\u2026 \"# A more memory-eff\u2026\n##  9 -rwxr-xr-x       0 ligges    users      3676 Aug   14    2016    BGLR\/\u2026 2016-08-14 BGLR  util\u2026 \"\\n readBinMat=funct\u2026\n## 10 -rw-r--r--       0 ripley    users      2547 Feb   04    2015    BLCOP\u2026 2015-02-04 BLCOP util\u2026 \"###################\u2026\n## # ... with 1,736 more rows\n<\/code><\/pre>\n<p>Note that we somewhat expected the file source to potentially come in handy at a later date and also expected the need to revisit that post, so the <a href=\"https:\/\/rud.is\/dl\/utility-belt.rds\">R data file<\/a> [\u2190<em>direct link to RDS<\/em>] included a <code>file_src<\/code> column.<\/p>\n<p>Now, let's find all the source files with at least one infix definition, collect them together and parse them so we can do more code spelunking:<\/p>\n<pre><code class=\"language-r\">\nfilter(utils, stri_detect_fixed(file_src, \"`%\")) %>% # only find sources with infix definitions\n  pull(file_src) %>%\n  paste0(collapse=\"\\n\\n\") %>%\n  parse(text = ., keep.source=TRUE) -> infix_src\n\nstr(infix_src, 1)\n## length 1364 expression(dplyr::`%>%`, `%||%` <- function(a, b) if (is.null(a)) b else a, get_pkg_path <- function(ctx) {  pkg_| __truncated__ ...\n##  - attr(*, \"srcref\")=List of 1364\n##  - attr(*, \"srcfile\")=Classes 'srcfilecopy', 'srcfile' <environment: 0x7fbfc4339940> \n##  - attr(*, \"wholeSrcref\")= 'srcref' int [1:8] 1 0 15768 0 0 0 1 15768\n##   ..- attr(*, \"srcfile\")=Classes 'srcfilecopy', 'srcfile' <environment: 0x7fbfc4339940>\n<\/code><\/pre>\n<p>We can now take all of that lovely parsed source and tokenize it to work with the discrete elements in a very tidy manner:<\/p>\n<pre><code class=\"language-r\">\ninfix_parsed <- tbl_df(getParseData(infix_src)) # tbl_df() is mainly for pretty printing \n\ninfix_parsed\n## # A tibble: 118,242 x 9\n##    line1  col1 line2  col2    id parent token          terminal text      \n##  1     1     1     1    24     1    -10 COMMENT        TRUE     #' @impor\u2026\n##  2     2     1     2    10     4    -10 COMMENT        TRUE     #' @export\n##  3     3     1     3    12    10      0 expr           FALSE    \"\"        \n##  4     3     1     3     5     7     10 SYMBOL_PACKAGE TRUE     dplyr     \n##  5     3     6     3     7     8     10 NS_GET         TRUE     ::        \n##  6     3     8     3    12     9     10 SYMBOL         TRUE     `%>%`     \n##  7     5     1     5    49    51      0 expr           FALSE    \"\"        \n##  8     5     1     5     6    16     18 SYMBOL         TRUE     `%||%`    \n##  9     5     1     5     6    18     51 expr           FALSE    \"\"        \n## 10     5     8     5     9    17     51 LEFT_ASSIGN    TRUE     <-        \n## # ... with 118,232 more rows\n<\/code><\/pre>\n<p>We just need to find a sequence of tokens that make up a function definition, then whittle those down to ones that look like our <code>%<\/code> infix names:<\/p>\n<pre><code class=\"language-r\">\npat <- c(\"SYMBOL\", \"expr\", \"LEFT_ASSIGN\", \"expr\", \"FUNCTION\") # pattern for function definition\n\n# find all of ^^ sequences (there's a good twitter discussion on this abt a month ago)\nidx <- which(infix_parsed$token == pat[1]) # find location of match of start of seq\n\n# look for the rest of the sequences starting at each idx position\nmap_lgl(idx, ~{\n  all(infix_parsed$token[.x:(.x+(length(pat)-1))] == pat)\n}) -> found\n\nf_defs <- idx[found] # starting indices of all the places where functions are defined\n\n# filter ^^ to only find infix ones\ninfix_defs <- f_defs[stri_detect_regex(infix_parsed$text[f_defs], \"^`\\\\%\")]\n\n# there aren't too many, but remember we're just searching `util` functions\nlength(infix_defs)\n## [1] 106\n<\/code><\/pre>\n<p>Now, write it out to a file so we can peruse the infix functions:<\/p>\n<pre><code class=\"language-r\">\n# nuke a file and fill it with the function definition\ncat(\"\", sep=\"\", file=\"infix_functions.R\")\nwalk2(\n  getParseText(infix_parsed, infix_parsed$id[infix_defs]),     # extract the infix name\n  getParseText(infix_parsed, infix_parsed$id[infix_defs + 3]), # extract the function definition body\n  ~{\n    cat(.x, \" <- \", .y, \"\\n\\n\", sep=\"\", file=\"infix_functions.R\", append=TRUE)\n  }\n)\n<\/code><\/pre>\n<p>There are 106 of them so you can find the extracted ones <a href=\"https:\/\/gist.github.com\/hrbrmstr\/58b827dea95a7adf0f0e751b44b75b0c\">in this gist<\/a>.<\/p>\n<p>Here's an overview of what you can expect to find:<\/p>\n<pre>\n# A tibble: 39 x 2\n   name                 n\n 1 `%||%`              47\n 2 `%+%`                7\n 3 `%AND%`              4\n 4 `%notin%`            4\n 5 `%:::%`              3\n 6 `%==%`               3\n 7 `%!=%`               2\n 8 `%*diag%`            2\n 9 `%diag*%`            2\n10 `%nin%`              2\n11 `%OR%`               2\n12 `%::%`               1\n13 `%??%`               1\n14 `%.%`                1\n15 `%@%`                1\n16 `%&&%`               1\n17 `%&%`                1\n18 `%+&%`               1\n19 `%++%`               1\n20 `%+|%`               1\n21 `%<<%`               1\n22 `%>>%`               1\n23 `%~~%`               1\n24 `%assert_class%`     1\n25 `%contains%`         1\n26 `%din%`              1\n27 `%fin%`              1\n28 `%identical%`        1\n29 `%In%`               1\n30 `%inr%`              1\n31 `%M%`                1\n32 `%notchin%`          1\n33 `%or%`               1\n34 `%p%`                1\n35 `%pin%`              1\n36 `%R%`                1\n37 `%s%`                1\n38 `%sub_in%`           1\n39 `%sub_nin%`          1\n<\/pre>\n<h3>FIN<\/h3>\n<p>If any of those are useful, feel free to PR them in to <a href=\"https:\/\/github.com\/hrbrmstr\/freebase\/blob\/master\/inst\/templates\/infix-helpers.R\">https:\/\/github.com\/hrbrmstr\/freebase\/blob\/master\/inst\/templates\/infix-helpers.R<\/a> (and add yourself to the <code>DESCRIPTION<\/code> if you do).<\/p>\n<p>Hopefully this provided some further inspiration to continue to use R not only as your language of choice but also as a fun data source.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Regular readers will recall the &#8220;utility belt&#8221; post from back in April of this year. This is a follow-up to a request made asking for a list of all the % infix functions in those files. We&#8217;re going to: collect up all of the sources parse them find all the definitions of % infix functions [&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":[91],"tags":[],"class_list":["post-10834","post","type-post","status-publish","format-standard","hentry","category-r"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The Fix Is In: Finding infix functions inside contributed R package &quot;utilities&quot; files - 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\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Fix Is In: Finding infix functions inside contributed R package &quot;utilities&quot; files - rud.is\" \/>\n<meta property=\"og:description\" content=\"Regular readers will recall the &#8220;utility belt&#8221; post from back in April of this year. This is a follow-up to a request made asking for a list of all the % infix functions in those files. We&#8217;re going to: collect up all of the sources parse them find all the definitions of % infix functions [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-29T12:42:06+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\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"The Fix Is In: Finding infix functions inside contributed R package &#8220;utilities&#8221; files\",\"datePublished\":\"2018-05-29T12:42:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/\"},\"wordCount\":303,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"articleSection\":[\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/\",\"url\":\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/\",\"name\":\"The Fix Is In: Finding infix functions inside contributed R package \\\"utilities\\\" files - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"datePublished\":\"2018-05-29T12:42:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Fix Is In: Finding infix functions inside contributed R package &#8220;utilities&#8221; files\"}]},{\"@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":"The Fix Is In: Finding infix functions inside contributed R package \"utilities\" files - 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\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/","og_locale":"en_US","og_type":"article","og_title":"The Fix Is In: Finding infix functions inside contributed R package \"utilities\" files - rud.is","og_description":"Regular readers will recall the &#8220;utility belt&#8221; post from back in April of this year. This is a follow-up to a request made asking for a list of all the % infix functions in those files. We&#8217;re going to: collect up all of the sources parse them find all the definitions of % infix functions [&hellip;]","og_url":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/","og_site_name":"rud.is","article_published_time":"2018-05-29T12:42:06+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\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"The Fix Is In: Finding infix functions inside contributed R package &#8220;utilities&#8221; files","datePublished":"2018-05-29T12:42:06+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/"},"wordCount":303,"commentCount":1,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"articleSection":["R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/","url":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/","name":"The Fix Is In: Finding infix functions inside contributed R package \"utilities\" files - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"datePublished":"2018-05-29T12:42:06+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2018\/05\/29\/the-fix-is-in-finding-infix-functions-inside-contributed-r-package-utilities-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"The Fix Is In: Finding infix functions inside contributed R package &#8220;utilities&#8221; files"}]},{"@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-2OK","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":12891,"url":"https:\/\/rud.is\/b\/2021\/01\/23\/swiftr-switcheroo-calling-compiled-swift-from-r\/","url_meta":{"origin":10834,"position":0},"title":"SwiftR Switcheroo: Calling [Compiled] Swift from R!","author":"hrbrmstr","date":"2021-01-23","format":false,"excerpt":"I've been on a Swift + R bender for a while now, but have been envious of the pure macOS\/iOS (et al) folks who get to use Apple's seriously ++good machine learning libraries, which are even more robust on the new M1 hardware (it's cool having hardware components dedicated to\u2026","rel":"","context":"In &quot;macOS&quot;","block_context":{"text":"macOS","link":"https:\/\/rud.is\/b\/category\/macos\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12917,"url":"https:\/\/rud.is\/b\/2021\/01\/26\/making-it-easier-to-experiment-with-compiled-swift-code-in-r\/","url_meta":{"origin":10834,"position":1},"title":"Making It Easier To Experiment With Compiled Swift Code In R","author":"hrbrmstr","date":"2021-01-26","format":false,"excerpt":"The past two posts have (lightly) introduced how to use compiled Swift code in R, but they've involved a bunch of \"scary\" command line machinations and incantations. One feature of {Rcpp} I've always ? is the cppFunction() (\"r-lib\" zealots have a similar cpp11::cpp_function()) which lets one experiment with C[++] code\u2026","rel":"","context":"In &quot;macOS&quot;","block_context":{"text":"macOS","link":"https:\/\/rud.is\/b\/category\/macos\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11070,"url":"https:\/\/rud.is\/b\/2018\/07\/14\/alleviating-aws-athena-aggravation-with-asynchronous-assistance\/","url_meta":{"origin":10834,"position":2},"title":"Alleviating AWS Athena Aggravation with Asynchronous Assistance","author":"hrbrmstr","date":"2018-07-14","format":false,"excerpt":"I've blogged about how to use Amazon Athena with R before and if you are a regular Athena user, you've likely run into a situation where you prepare a dplyr chain, fire off a collect() and then wait. And, wait. And, wait. And, wait. Queries that take significant processing time\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":11427,"url":"https:\/\/rud.is\/b\/2018\/08\/24\/friday-rstats-twofer-finding-macos-32-bit-apps-processing-data-from-system-commands\/","url_meta":{"origin":10834,"position":3},"title":"Friday #rstats twofer: Finding macOS 32-bit apps &#038; Processing Data from System Commands","author":"hrbrmstr","date":"2018-08-24","format":false,"excerpt":"Apple has run the death bell on 32-bit macOS apps and, if you're running a recent macOS version on your Mac (which you should so you can get security updates) you likely see this alert from time-to-time: If you're like me, you click through that and keep working but later\u2026","rel":"","context":"In &quot;Apple&quot;","block_context":{"text":"Apple","link":"https:\/\/rud.is\/b\/category\/apple\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-24-at-4.58.41-AM.png?fit=1200%2C612&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-24-at-4.58.41-AM.png?fit=1200%2C612&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-24-at-4.58.41-AM.png?fit=1200%2C612&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-24-at-4.58.41-AM.png?fit=1200%2C612&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-24-at-4.58.41-AM.png?fit=1200%2C612&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":9496,"url":"https:\/\/rud.is\/b\/2018\/04\/08\/dissecting-r-package-utility-belts\/","url_meta":{"origin":10834,"position":4},"title":"Dissecting R Package &#8220;Utility Belts&#8221;","author":"hrbrmstr","date":"2018-04-08","format":false,"excerpt":"Many R package authors (including myself) lump a collection of small, useful functions into some type of utils.R file and usually do not export the functions since they are (generally) designed to work on package internals rather than expose their functionality via the exported package API. Just like Batman's utility\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/04\/r-utility-belt-final.png?fit=891%2C375&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/04\/r-utility-belt-final.png?fit=891%2C375&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/04\/r-utility-belt-final.png?fit=891%2C375&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/04\/r-utility-belt-final.png?fit=891%2C375&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":4560,"url":"https:\/\/rud.is\/b\/2016\/07\/26\/use-quick-formula-functions-in-purrrmap-base-vs-tidtyverse-idiom-comparisonsexamples\/","url_meta":{"origin":10834,"position":5},"title":"Use quick formula functions in purrr::map (+ base vs tidtyverse idiom comparisons\/examples)","author":"hrbrmstr","date":"2016-07-26","format":false,"excerpt":"I've converted the vast majority of my *apply usage over to purrr functions. In an attempt to make this a quick post, I'll refrain from going into all the benefits of the purrr package. Instead, I'll show just one thing that's super helpful: formula functions. After seeing this Quartz article\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":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/10834","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=10834"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/10834\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=10834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=10834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=10834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}