Publications by R - datawookie
Enforcing Style in an R Project
In the previous post we looked at how to apply a linter and styler to a Python Project. Now we’re going to do the same for an R project. We’ll use the {precommit} R package to make the setup a breeze. Install Install the {precommit} package. install.packages("precommit") Setup Setup precommit for a project. precommit::use_precommit() That wil...
2725 sym R (2455 sym/9 pcs) 2 img
Scaling Density Plots
I’m a density plot devotee. And, using geom_density() from {ggplot2} these plots are effortless to produce. However, sometimes the results of geom_density() are not exactly what I’m after. Here’s how I tweak them to give me precisely what I need. The Data We’ll use a slightly modified version of the penguins data from the {palmerpenguins}...
4101 sym R (1020 sym/7 pcs) 14 img
Unravelling Transparency in Coverage Data
I have a challenge: extracting data from an enormous JSON file. The structure of the file is not ideal: it’s a mapping at the top level, which means that for most standard approaches the entire document needs to be loaded before it can be processed. It would have been so much easier if the top level structure was an array. But, alas. It’s alm...
4250 sym R (3332 sym/14 pcs) 2 img
Unravelling an Enormous JSON
I have a challenge: extracting data from an enormous JSON file. The structure of the file is very challenging: it’s a mapping at the top level, which means that for most standard approaches the entire document needs to be loaded before it can be processed. It would have been so much easier if the top level structure was an array. But, alas. It�...
3917 sym R (2779 sym/13 pcs) 2 img
Linux Packages for R
Getting R set up on Linux can be somewhat frustrating. Many of the fundamental packages (like {devtools} or {remotes}) have implicit system dependencies. So installing these packages can involve numerous iterations back and forth between R and the shell while you figure out what those dependencies are and get them all installed. I’ve been throu...
984 sym R (238 sym/1 pcs) 2 img
Historical Weather Data
I’m building a model which requires historical weather data from a selection of locations in South Africa. In this post I demonstrate the process of acquiring the data and doing some simple processing. I need data for three locations: Brookes and Goje (in KwaZulu-Natal) and Hlangalane (in the Eastern Cape). # A tibble: 3 × 4 name regio...
1927 sym R (4236 sym/8 pcs) 8 img
Schools in England
I’ve just added data on schools in England to the {blimey} package. The raw data were obtained from gov.uk. Load the Package If you haven’t installed the package, then grab it from GitHub. devtools::install_github("datawookie/blimey") Load the package. library(blimey) Schools Data The schools data are in the schools package variable. Let’s ...
1258 sym R (1775 sym/4 pcs) 4 img
Postboxes & Postal Codes
I’ve just added some more data to the {blimey} package: postal codes and postbox locations. Data Sources The postal code data was acquired from gov.uk as a collection of CSV files. The data were read and consolidated into a single data frame. The coordinates were transformed from CRS 27700 (British National Grid) to CRS 4326 (World Geodetic S...
1985 sym R (1677 sym/6 pcs) 4 img
Using Shiny Server in Docker
A quick note on how to use the Shiny Server Docker image, rocker/shiny. I’m a big believer in starting with the simplest possible setup, getting that to work and then adding complexity in layers. We’ll start with a simple Shiny application in app.R. library(shiny) ui <- fluidPage( titlePanel("Example Shiny Application") ) server <- functi...
1457 sym R (337 sym/4 pcs) 2 img
Calculating the Fire Danger Index (FDI)
In a previous post I took a look at some granular weather data that I acquired via the Weather API. One interesting application of these data is calculating the Fire Danger Index (FDI), which measures the degree of fire danger using information on dryness, wind speed, temperature and humidity. FDI is often presented at a fairly coarse spatial re...
2670 sym R (1731 sym/3 pcs) 8 img