• Making an R based ML model accessible through a simple API

    Building an accurate machine learning (ML) model is a feat on its own. But once you’re there, you still need to find a way to make the model accessible to users. If you want to create a GUI for it, the obvious approach is going after shiny. However, often you don’t want a direct GUI for a ML model but you want to integrate the logic you’ve created into an existing (or new) application things become a bit more difficult.

    Let’s say you’ve created a robust ML model in R and explain the model to your in-house IT department, it is (currently) definitely not a given that they can easily integrate it. Be it either due to the technology used is unfamiliar to them or because they simply don’t have a in-depth knowledge on ML.

    Continue reading →

  • simmer 3.0.0 is on CRAN

    I’m very pleased to announce the first CRAN release of simmer. (https://cran.rstudio.com/web/packages/simmer/). This release has been realised thanks to the efforts made by Iñaki.

    To reiterate a bit, simmer is a discrete-event simulation (DES) package for R. It is the first R package that focuses on creating a robust DES framework for R. It provides a framework somewhat similar as e.g SimPy and SimJulia but is arguably written from a bit more of an applied angle.

    R might not be the most efficient language to implement a DES framework due to its method of memory allocation. Therefore, simmer implements a C++ backend by making use of Rcpp.

    Continue reading →

  • jug 0.1.0 on CRAN

    Jug is a package to allow you to easily create web APIs based on your R codestack.

    Documentation and examples can be found at: http://bart6114.github.io/jug/

    Continue reading →

  • Jug: Easily Create R APIs

    Jug stands for Just Unified Galloping. Okay, okay, it’s just a play on words coming from a Flask (Python) background.

    Jug is my attempt to create a simple small web framework that allows you to turn your (existing) R functions into an API. Having the wonderful httpuv package at my disposal made this very easy for me.

    So, how does this work?

    Let’s say I have the following function:

    say_hello_to<-function(name) paste("Hello", name)

    Sometimes you would be in a situation where you want to send a GET request to a server and let a function (let’s say the one above) return it’s result. Thus, I want to expose the above function to allow HTTP GET requests to acces it. Using Jug I could do something like this:

    jug() %>%
      gett("/", decorate(say_hello_to)) %>%
    Serving the jug at

    However, when I run this code and post a GET request to the URL, the following happens:

    $ curl
    ERROR: argument "name" is missing, with no default

    Obviously, because the function say_hello_to requires the parameter name. A second attempt has better results:

    $ curl
    Hello Bart

    Continue reading →

  • dimple charts for R

    dimple is a simple-to-use charting API powered by D3.js.

    Making use of the nice htmlwidgets package it only took a minimum amount of coding to make the dimple library available from R.

    You can find the dimple R package at github.com/Bart6114/dimple and some documentation and examples at: bart6114.github.io/dimple (can take a while to load). Using the package you can create static javascript-based graphs, but you can also use dimple charts in Shiny applications.


  • licorice: plot Likert-like data

    I wanted to create a nice visualization from a survey data set. I quickly stumbled upon the likert package (go check it out).

    I did however have some trouble getting it to work the way I wanted. Therefore I made a quick implementation of my own that you can install from GitHub: github.com/Bart6114/licorice (check out the GitHub README for more info).

    Below you can see an example plot. It is a basic ggplot2 object which you can add upon to your liking. The plot below has been themed using the ggthemr package.

  • infuser: a template engine for R

    Version 0.1 of infuser was just released on CRAN.

    infuser is a very basic templating engine. It allows you to replace parameters in character strings or text files with a given specified value.

    I would often include some SQL code in my R scripts so that I could make parameters in the SQL code variable. But I was always a bit hesitant on the cleanliness of this. It irked me so much that I finally wrote this very simple package. The infuse function allows me to read in a text file (or a character string for that matter) and infuse it with the requested values.

    Continue reading →

  • sparklines for R

    I’ve always liked the jQuery Sparklines library and today I had a use case for implementing these in one of my Rmarkdown reports.

    While it wouldn’t be too difficult to staticly include a javascript based chart, ideally I would simply want to dynamically generate the sparkline using values computed in R. Luckily we now have htmlwidgets for R. This library makes it stupidly simple to integrate javascript libraries in R code. It simply up to one who has a use case for integrating a javascript library with R to insert some glue code: and so sparklines was born.

    Continue reading →

  • scheduleR receives big update

    For the newcomers; scheduleR is a framework to deploy/schedule R tasks, reports and Shiny apps. The tool has an integrated logging and notification system to ease the maintenance of scheduled R related jobs.

    After a lot of refactoring the tasks have been separated into tasks (e.g. ETL scripts) and reports (rmarkdown). The back-end that handles the execution of R scripts has gotten a polish, as did the UI.

    Continue reading →

  • Compensation in artifical neural networks

    Last week I was at the succesful doctoral defence of Wouter on the role of the cerebellum while walking. During the questions, the topic of compensation came up: if a part of your neural system gets damaged can other parts (over time) take over some of its functionality? The answer is most probably yes, but only to some extent.

    Continue reading →

  • New blog

    %$*! my server crashed… Oh well, might as well take this opportunity to start with a fresh blog platform. I’ll be using Jekyll from now on.

    The texts of my posts have (mostly) been preserved, I will start recovering old posts in the coming days / weeks.

  • scheduleR: a web interface to schedule .R & .Rmd scripts

    This post has been transferred from another blog platform and could have dead links / incorrect lay-out.

    scheduleR is an attempt to create an intuitive interface for scheduling R and Rmarkdown scripts. Especially for the latter, I find the lack of a good scheduling, logging and notification tool the reason for why I don’t use Rmarkdown as much as I could for generating business report / dashboards.

    Continue reading →

  • Introducing simmer: Discrete Event Simulation for R

    This post has been transferred from another blog platform and could have dead links / incorrect lay-out.

    Please note: the syntax described here is no longer up-to-date, please refer to the readme at simmer’s GitHub page.

    The simmer package grew out of a personal need for a simple rapid development discrete event simulation (DES) framework. I work in the hospital sector and at times use a DES approach to simulate hospital processes / patient trajectories. DES can give you a quick look at process bottlenecks and test out the impact of alternative process set-ups.

    Continue reading →