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.

I am not a Data Scientist - My R journey

Today is the fifth anniversary of my joining Data science consultancy, Mango Solutions. That also means it’s my fifth anniversary of using and working with R. My background, when I joined mango was in Unix system administration and database administration, but I’d also worked on some ETL projects and had experience of running large compute clusters. I joined Mango as part of the IT team and was quickly set to work on my first big project: Integrating RStudio Server into a pharmacokinetics/pharmacodynamics (PK/PD) platform for a large pharmaceutical company.

dater - a tiny Addin for RStudio

Inserting a date with a keyboard shortcut TLDR: You can find the dater package on github. Update 1: It seems all of this was for nothing… Tweet from @verajosemanuel …but still, it’s a good excuse to learn more about Addins! Update 2: Jose (see above) was kind enough to expand on his original response to my tweet about this post and has introduced me to the wonderful world of RStudio snippets!

Learn to Write Command Line Utilities in R - part 7

Check out the first post in this series for an index of all the other posts. In this post, we’re going to look at extending the work we’ve done earlier by adding another flag into the mix. We’ll use that to improve the way the output of the tool looks when it runs. First of all, we need to add our new flag to the argparser config. # Add a pretty printing flag p <- add_argument(p, "--pretty", help="pretty print the output", flag=TRUE) And we’ll also need a new function to handle those inputs.

Field Guide to the R Ecosystem

I started working with R around about 5 years ago. Parts of the R world have changed substantially over that time, while other parts remain largely the same. One thing that hasn’t changed however, is that there has never been a simple, high-level text to introduce newcomers to the ecosystem. I believe this is especially important now that the ecosystem has grown so much. It’s no longer enough to just know about R itself.

Learn to Write Command Line Utilities in R - part 6

Check out the first post in this series for an index of all the other posts. In the first parts of this series we explored how to create simple command line utilities in R. In part 5 we talked about how difficult it is to go beyond a couple of parameters. This part will remove that limitation and allow us to take our command line apps to a whole new level, delivering the look and feel of existing command line utilities.

Learn to Write Command Line Utilities in R - part 5

Check out the first post in this series for an index of all the other posts. Last time, we changed the way our sorting hat command line utility did its sorting. We moved away from random assignment and implemented a simple binning system for our input names. While we fixed a major problem with our utility, we didn’t really learn much about writing command line tools, so in this post, we’ll look at implementing some debug logging to let us know what’s happening inside our app while it’s running.

Learn to Write Command Line Utilities in R - part 4

Check out the first post in this series for an index of all the other posts. In previous posts, we’ve been working on our command line Sorting Hat utility. We started out with a really simple tool that ran on the command line and just output a random Hogwarts house. Since then, we’ve extended that to accept an argument – in this case a name – and also added some input validation and an error message.

Learn to Write Command Line Utilities in R - part 3

Check out the first post in this series for an index of all the other posts. Yesterday we modified our simple sorting hat command line utility to accept it’s first argument, a name. Those of you who’ve been playing along may have noticed that our implementation wasn’t ideal. It’s fine if you run the script with an argument, like ./sortinghat.R Daphne, but what happens if you omit the argument? $ .