Posts with the R tag

Simple GitLab CI/CD pipeline for testing R package commits

R git GitLab CI/CD DevOps

18 March, 2022

– This is a quick intro discussing how to write a simple GitLab CI/CD pipeline for testing your R packages.



How to set up Shiny Server on a Ubuntu 20.04 server from Digital Ocean

Linux R

10 February, 2022

– We can use RStudio's open-source version of Shiny Server to host our own Shiny apps on a Ubuntu 20.04 cloud server.



Warning message: package ‘x’ was built under R version 'y'

R

2 February, 2022

– It's a fairly common warning message, but usually nothing to worry about. I'll describe why it occurs, and what you might want to do about it, here.



How to count the number of NA values in each variable of a data frame in R

R

19 January, 2022

– I like to check the number of NA values in my data frames so frequently that I've written a very simple function to do so.



How to automate R reports on Linux with cron jobs

Linux R

11 November, 2021

– This post describes how to set up a cron job on Linux to automate data analysis pipelines with R scripts or R Markdown reports.



The inverse-transform method for generating random variables in R

R Statistics and data science

4 September, 2021

– It's possible to generate random variables from a specific distribution by using the inverse of the cumulative distribution function. We'll see how to do this with a few specific examples in R.



How to filter several variables with the same condition in R

R

9 July, 2021

– This is a super brief post demonstrating an easy way to filter several variables on the same condition in R, using dplyr's across function.



Training vs test mean squared error in R

R Statistics and data science

24 June, 2021

– Mean squared error (MSE) is an important measure of models that predict continuous variables. When we're using it to evaluate our model, however, we need to be careful that we're using the test MSE rather than the training MSE. We'll go over the differences here, using some examples in R.



How to add titles to a layer control box in a Leaflet map in R

GIS R Leaflet

28 May, 2021

– Leaflet's layer control boxes allow you to select, show or hide different layers. But there's no default parameter to supply a title to the box. Fortunately this is an easy fix in R with a bit of JavaScript.



Geographical sorting is not a thing

GIS Shiny R

16 August, 2020

– In this tutorial, we run through some little-known but extremely attractive options for making life as hard as possible for your app's users.



Click to zoom in on polygon in Leaflet maps with Shiny

GIS Shiny R Leaflet

12 July, 2020

– An easy way to add further interactivity to Leaflet maps rendered in R Shiny apps is to enable zoom-to-point functionality for your polygons. There currently isn't an out-of-the-box solution for this, but it's pretty easy ...



Converting backslashes to forward slashes in R on Windows

R

8 June, 2020

– C:\this\is\a\typical\filepath\ that\I\find\myself\copying\ and\pasting\into\R. If you've ever done the same, you'll know how fun it is going through and substituting the backslashes for forward slashes ..



Dependent selectInput objects in Shiny apps that you can bypass

Shiny R

4 February, 2020 (updated 2 November, 2022)

– I see this question pop up on Stack Overflow all the time. How do you tie together multiple selectInputs (or selectizeInputs), making the child input dependent on the parent input, but still allowing the user to bypass the first input? In other ...



Displaying ggplot messages in a Shiny app

Shiny R ggplot

8 January, 2020

– It turns out that capturing and displaying in a Shiny app the warning and error messages generated by ggplot isn't as simple as you might think. In order to discover why that is, we need to know a little bit about what happens behind the scenes ...



GIS in R using the Google Maps API

GIS R

5 December, 2019

– Everyone loves maps. If you're tired of seeing maps without New Zealand in them, why not learn how to build your own? We'll be querying the Google Maps API to build a base map, and then using some publicly available data to visualise ...