Running an R Script on a Schedule: Heroku

Tweeting from heroku

In this tutorial I have an R script that runs every day on heroku. It creates a curve in ggplot2 and posts that picture to twitter. The use case is this: You have a script and it needs to run on a schedule (for instance every day). In 2018 I wrote a small post how to run an R script on heroku. The amazing thing is that the bot I created back then is still running! [Read More]

How Does Catboost Deal with Factors in loading?

What are you doing catboost?

Some people at curso-r, are working on an amazing extension of parsnip and allow you to use tidymodels packages like {parsnip} and {recipes} with the modern beasts of machine learning: lightgbm and catboost. the package is called treesnip and is still in development. Both lightgbm and catboost can work with categorical features but how do you pass those to the machinery? Both lightgbm and catboost use special data structures. I was reading through the catboost documentation and it just wasn’t very clear to me. [Read More]

Expressing size in bananas a dive into {vctrs}

Yes I made a stupid package to express lengths in bananas

Recently I’ve become interested in relative sizes of things. Maybe I’m paying more attention to my surroundings since I’m locked at home for so long. Maybe my inner child is finally breaking free. Whatever the reason, I channeled all of that into two packages: everydaysizes A rather unfinished collection of dimensions of everyday objects. banana A package that displays dimensions as … bananas. I’ve collected a bunch of sizes and turned them into ‘units’. [Read More]

Munging and reordering Polarsteps data

Turning nested lists into a data.frame with purrr

This post is about how to extract data from a json, turn it into a tibble and do some work with the result. I’m working with a download of personal data from polarsteps. A picture of Tokomaru Wharf (New Zealand) I was a month in New Zealand, birthplace of R and home to Hobbits. I logged my travel using the Polarsteps application. The app allows you to upload pictures and write stories about your travels. [Read More]

Graphing My Daily Phone Use

How many times do I look at my phone? I set up a small program on my phone to count the screen activations and logged to a file. In this post I show what went wrong and how to plot the results. The data I set up a small program on my phone that counts every day how many times I use my phone (to be specific, it counts the times the screen has been activated). [Read More]

Logging my phone use with tasker

In this post I’ll show you how I logged my phone use with tasker, in a follow up post I’ll show you how I visualized that. I had a great vacation last week but relaxing in Spain I thought about my use of technology and became a bit concerned with how many times I actually look at my phone. But how many times a day do I actually look at my phone? [Read More]

Tweeting daily famous deaths from wikidata to twitter with R and docker

A tweet a day keeps the insanity at bay

In this explainer I walk you through the steps I took to create a twitter bot that tweets daily about people who died on that date. I created a script that queries wikidata, takes that information and creates a sentence. That sentence is then tweeted. For example: A tweet I literally just send out from the docker container I hope you are has excited as I am about this project. [Read More]

Use `purrr` to feed four cats

Replacing a for loop with purrr::map_*

Use purrr to feed four cats In this example we will show you how to go from a ‘for loop’ to purrr. Use this as a cheatsheet when you want to replace your for loops. Imagine having 4 cats. (like this one:) Four real cats who need food, care and love to live a happy life. They are starting to meow, so it’s time to feed them. Our real life algorithm would be: [Read More]

How to set up GNU Terry Pratchett on hugo with netlify

Keeping Terry Pratchett alive in static websites

TL;DR: In this post I will show you how to set up special header information on a static website such as hugo + netlify. Netlify interprets the _headers file and applies the rules to your website. You only have to set a simple rule, and now you too can keep Terry Pratchett alive! GNU Terry Pratchett On March 12th 2015 one of my favorite writers; Terry Pratchett died, but the people of the internet were not ready to let him go. [Read More]

Downloading files from a webserver, and failing.

Recently I wanted to download all the transcripts of a podcast (600+ episodes). The transcripts are simple txt files so in a way I am not even ‘web’-scraping but just reading in 600 or so text files which is not really a big deal. I thought. This post shows you where I went wrong Also here is a picture I found of scraping. Webscraping general For every download you ask the server for a file and it returns the file (this is also how you normally browse the web btw, your browser requests the pages). [Read More]