The 12 R functions of Xmas pt6/6

Welcome to the last in this little series of R functions built for fun. If you’ve not been following along from the start feel free to head back to the first post in the series and check that out too. That post explains the thinking behind the series and has an index to the other posts. Sleigh or ISS Over the Christmas period, when you look upwards and see a bright object streaking across the sky you might wonder to yourself: “Is that a sleigh, or the International Space Station?

The 12 R functions of Xmas pt5/6

Nearly at the end now! If you want to go back and see where we started, check out this post. Not quite rot13 I confess, I cheated a little with this one. This function has two other functions declared inside it, technically making this ‘the 14 R functions of xmas’. It’s also fine example of how not to design a function. This function actually implements a variation on the real ROT13, which is a simple substitution cipher that replaces each letter with the letter 13 steps after it in the alphabet, looping back to “a” when you reach “z”.

The 12 R functions of Xmas pt4/6

Wow, we’re already up to part 4 of this little series! If you want to go back and see where we started, check out this post. Today’s two (mostly pointless) R functions are evolutions of things we seen before. In the first we have more URL manipulation and in the second, more fun with sample(). Simple tweet In the 2nd installment we wrote a small function to launch a gif search on Giphy.

The 12 R functions of Xmas pt3/6

Now that we’re at day three, you hopefully know the drill (if not, check out the first of these posts). I wrote 12 small and simple R functions, basically just for a bit of fun and I’m sharing them here to spread the fun around a little. Today’s functions are a number guessing game that reads user input and a function that tries to make us feel like we’ve been sucked into a retro sci-fi movie!

The 12 R functions of Xmas pt2/6

{width=100%} Yesterday I posted the first two of the 12 small and hopefully fun R functions that I challenged myself to write last weekend. If you read that post, you’ll already get the idea. They’re small and fun functions that also do something small and fun! I wanted to stick to no more than a single function (though I may have cheated a bit in at least one of them) in order to ensure that the scope stayed small and I didn’t distract myself with too many unnecessary features.

The 12 R functions of Xmas

For the other posts in this series check out the following links: Part 1 - barcode_game and days_until_xmas (This post) Part 2 - giphy_search and roll_dice Part 3 - what_number and sci-fi_terminal Part 4 - simple_tweet and magic_R_ball Part 5 - rot13 and awesome_blogdown Part 6 - sleigh_or_iss, twelve_days and unwrap_package A couple of weeks ago I tweeted about coding as a form of procrastination. It’s something I do quite a bit, but I also do something far more annoying that keeps me from coding altogether.

Adding a package to RStudio Package Manager from R

Update (2018-12-8): I completely forgot to point out in the original post that RSPM can be used to publish rpackages directly from a git repo. This is a brilliant solution for continuous deployment type scenarios. Check the docs for more information! If you’ve read any of my previous posts you’ll know I’m a big fan of RStudio Package Manager (RSPM). It’s a great tool for enterprise users of R to take control of the way they distribute R packages within their organisation.

Getting stringi to work with RStudio Connect

If you’re working with R in a Red Hat Linux based environment with no access to the internet and need to install the stringi package you’ll no doubt run into issues with ICU library that it relies on. At the time of writing, stringi (1.2.4) relies on libicu (called ‘libicu-devel’ on Red Hat based systems). Red Hat 7.5 only has libicu-devel version 50 and stringi needs 52 or higher. During installation, if it can’t find the version it needs, it tries to download a version it can compile against from the internet.

Writing a git pre-commit hook in R

What are git hooks? From githooks.com Git hooks are scripts that Git executes before or after events such as: commit, push, and receive. Git hooks are a built-in feature - no need to download anything. They’re basically bits of code that are triggered by a particular git event. The code can do anything you like. For instance you could use the ‘pre-push’ hook to trigger some code immediately prior to a git push.

Learn to write command line utilities in Python

If you read my series of posts on writing command line utilities in R, but were wondering how to do the same thing in Python, you’ve come to the right place. I learned a lot with that original series of posts though, so this time we’re going to switch things up a bit, dive right into a complete working example, and cover it all off in a single post. So let’s roll up our sleeves and get started!