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!

R in Prod: rip, a command line R package installer

If you’re responsible for the administration of R environments, you may have wished for an R equivalent of python’s pip tool for installing packages from the command line. R was originally designed to be more of an interactive user environment. This means things exist first and foremost within R itself, including the package installation function, install.packages(). More recently – and particularly since its usage has exploded – R’s user-base and the types of usage have diversified immensely.

New from RStudio: Package Manager

The post originally appeared on the Mango Solutions blog. One of the few remaining hurdles when working with R in the enterprise is consistent access to CRAN. Often desktop class systems will have unrestricted access while server systems might not have any access at all. This inconsistency often stems from security concerns about allowing servers access to the internet. There have been many different approaches to solving this problem, with some organisations reluctantly allowing outbound access to CRAN, some rolling their own internal CRAN-like repositories, and others installing a fixed set of packages and leaving it at that.

Automating a simple static website: Awesome-Blogdown.com

I started the awesome blogdown list not long after I first heard about the blogdown package for R. I wanted a quick and easy way to showcase websites built with it, so I started a simple “awesome” style README page on GitHub. This was OK for a little while, but it soon started to bug me that the same sites were at the top. The top of the list is prime real estate, especially for the casual visitor who might just skim the first few entries before decided where to go next, so having some mechanism for rotating what’s presented there seemed like a good idea.

Running Python in the RStudio IDE

I’ve had a few different people ask me variants of the same question lately, which is: “How can I run python code on a server in a similar way to using R with RStudio Server”. The easy answer is that you can actually run python in the RStudio IDE, so I made a quick video to demonstrate how. After the video did the rounds on twitter a little, the ever-ahead-of-the-curve Bob Rudis replied with this exciting tidbit:

Quick Tip: Don't keep your data prep in the same project as your Shiny app

This post originally appeared on the Mango Solutions blog. If you use RStudio Connect to publish your Shiny app (and even if you don’t) take care with how your arrange your projects. If you have a single project that includes both your data prep and your Shiny app, packrat (which RSConnect uses to resolve package dependencies for your project) will assume the packages you used for both parts are required on the RSConnect server and will try to install them all.

First steps with data pipelines

If you’re a data scientist, data engineer or otherwise someone just starting to think about creating data pipelines, you could do a lot worse than check out make. Having a consistent and flexible way of executing your data pipeline should be an essential part of any data professionals toolkit. If you’re running macOS or Linux, chances are that you already have make installed. You may even have used it already when compiling a piece of software from source, since make was originally intended to help users ‘make’ or compile complex software projects.

A toy geolocation API in Python

I spent some time last night thinking about ways in which I could improve the Awesome Blogdown website. One of the things that I was interested in was the country where each site is located and I decided it would be fun to create a little web API so I could do country lookups based on either an IP address or a domain name. I’ve done some geolocation stuff in the past, but only using Linux command line tools and I did briefly consider building out an API on top of them but thankfully I resisted.

Packaging Shiny apps - A deep dive

(Or, how to write a Shiny app.R file that only contains a single line of code) This article originally appeared on the Mango Solutions blog. This post is long overdue. The information contained herein has been built up over years of deploying and hosting Shiny apps, particularly in production environments, and mainly where those Shiny apps are very large and contain a lot of code. Last year, during some of my conference talks, I told the story of Mango’s early adoption of Shiny and how it wasn’t always an easy path to production for us.