tidyr
Posts featuring tidyr

Iterating over multiple database tables with the tidyverse
Extracting data from multiple database tables with dplyr and purrr. Continue reading Iterating over multiple database tables with the tidyverse

Dynamic SQL queries with R
Programmatic querying with dynamic schema, table and column names. Continue reading Dynamic SQL queries with R

Dual axis charts in ggplot2 - how to make them and why they can be useful
Working with dual axis charts in ggplot2, with custom legends using manual scales and ggtext. Pareto charts, in particular, are a valid use of this technique. Continue reading Dual axis charts in ggplot2 - how to make them and why they can be useful
Getting to know Julia
Trying out some basic data operations (download, minimal wrangling and plotting) in Julia Continue reading Getting to know Julia

Separate SQL
Why you should consider keeping your SQL queries in a separate file. Continue reading Separate SQL

Inverness street maps
Ticking off the rstats bucket list - emulating Taras Kaduk’s street map - but in a Highland stylee with OSM, sf and ggdark Continue reading Inverness street maps

What song lyric sentiment analysis doesn't tell you
Trying out the rolldown package to display the results of comparing lyric sentiments to the reactions the music generates. TL/DR - Metallica baby!! Continue reading What song lyric sentiment analysis doesn't tell you

UK Energy company acquisitions - a great use case for Sankey plots
Sankey plots are the ideal chart type to plot the flow of customers from collapsing energy companies. Here’s how to prepare your data with dplyr, before plotting with networkD3 Continue reading UK Energy company acquisitions - a great use case for Sankey plots

Enjoying the process of making tables in R using {reactable} and {reactablefmtr}
I thought making tables in R was dull, but it’s fun and engaging when you use reactable, and reactablefmtr. Interactivity, colour and visuals are all much improved. Continue reading Enjoying the process of making tables in R using {reactable} and {reactablefmtr}

I got my first package onto CRAN, and YOU CAN TOO
If I can do it, so can you. Feel the fear, do the checks, go for it. Here are some tips and links to help you get your package onto CRAN. Continue reading I got my first package onto CRAN, and YOU CAN TOO

Shooting Stars
Why you should consider starring repos on GitHub. Continue reading Shooting Stars

cusumcharter available on CRAN
Introducing the cusumcharter package which makes it easier to create and plot CUSUM control charts. Continue reading cusumcharter available on CRAN

Scheduling Rmarkdown files on Windows - your foolproof guide
Scheduling an Rmarkdown script can be tricky - there are a few issues that are not always obvious. Here’s how to run yours successfully Continue reading Scheduling Rmarkdown files on Windows - your foolproof guide

Passing parameters to SQL Server functions using R
How to parameterise an input into the SQL Server DATEADD function, via R. Useful when you want to pass an integer somewhere deep inside your SQL query Continue reading Passing parameters to SQL Server functions using R

fwf without the faff
Fixed width files aren’t too common, but they don’t have to be scary. readr comes to the rescue with read_fwf() Continue reading fwf without the faff

Calculating hotel occupancy with R
Putting patientcounter to the test by calculating hotel occupancy. Continue reading Calculating hotel occupancy with R

Well Well Well my Excel
I’m fed up forgetting how to combine lots of excel workbooks into one dataframe, so I’m documenting several ways of doing it, using purrr, data.table, rio and base R. Continue reading Well Well Well my Excel

Cutting down code in dplyr and data.table
Do we have to sacrifice readability for brevity? data.table allows succinct code, but so does tidyverse. data.table has some extra tricks up it’s sleeve though. Continue reading Cutting down code in dplyr and data.table

Introducing popthemes
Introducing another set of palettes and scales for ggplot2, based on pop album covers. Continue reading Introducing popthemes

Some data.table tips
Rolling joins, wrapping functions around regular DT[] calls, and more. Continue reading Some data.table tips

Scheduled Refresh - a surprisingly simple fix
Scheduled Refresh wasn’t working on our server, despite the correct credentials being supplied with the correct account and privileges. The fix was simple, but not particularly obvious. Continue reading Scheduled Refresh - a surprisingly simple fix

PreppinData - accepting the challenge with R and PowerBI
I’ve completed a month of ‘PreppinData’ challenges, using both R and PowerBI. Some things have been easy, some have not - here’s what I’ve learned in Week 1 Continue reading PreppinData - accepting the challenge with R and PowerBI

demystifying the coalesce function
coalesce is a one of those functions that might not strike you as being very useful, mainly because it doesn’t sound very exciting. But it IS useful, and might save you some time and complexity Continue reading demystifying the coalesce function

collapse might rock your world
collapse is a new force in the data transformation stakes. In this post, I try out one simple function and compare it to data.table and dplyr Continue reading collapse might rock your world

NHS-R Community Conference 2020
The 3rd Annual NHS-R Community Conference went virtual, and was an amazing success. Although I missed plenty, I saw more than enough good stuff to know that this is my team. And, everything’s online for catch up. Yay! Continue reading NHS-R Community Conference 2020

When dataviz meets 'reality'
The UK Government Coronavirus briefing on Saturday caused all sorts of consternation. Not least, the graphics that were presented in support of further lockdown. What happened, how bad was it really, and what could be improved? Continue reading When dataviz meets 'reality'

Getting started with network plots
Network plots can be hit or miss. For those of us used to tables or dataframes, the terminology is confusing. They often don’t look good. However, the visNetwork package changes all that as it greatly simplifies the process of producing useful, interactive network plots. Continue reading Getting started with network plots

The day after
Spreadsheets find themselves in the news for all the wrong reasons. Is R’s time in healthcare now? Continue reading The day after

metallicaRt
Seek and Destroy meets School of Rock as a new Metallica inspired colour pallete package hits the streets (in the city tonight) Continue reading metallicaRt

Rapid Analysis and Presentation of Quality Improvement Data with R
I presented at RMedicine2020 and really enjoyed it Continue reading Rapid Analysis and Presentation of Quality Improvement Data with R

Solving small data problems with data.table
Friday afternoon fun - how do we do we filter this data, combining elements from different rows and discarding NA values? Continue reading Solving small data problems with data.table

SIMD Revisited
Visualising the 2020 Scottish Index of Multiple Deprivation data using beewswarm plots, scatter plots and alternative ggplot2 themes and palettes. Continue reading SIMD Revisited

patientcounter
Introducing the patientcounter package for tracking moves between locations Continue reading patientcounter

Programming with data.table
getting started with multiple bare variable names in data.table functions. Continue reading Programming with data.table

data.table by a dummy - a dummies guide
A dummies guide to the fabulous data.table package, for new users to get up to speed quickly Continue reading data.table by a dummy - a dummies guide

A wee look at group_map and group_split in dplyr
Continue reading A wee look at group_map and group_split in dplyr
gganimation for the nation
gganimate is now on CRAN so taking it for a test drive Continue reading gganimation for the nation
Automatic (slides) for the people
Creating and saving multiple plots to Powerpoint Continue reading Automatic (slides) for the people

Where am I?
Notes on the here package Continue reading Where am I?

Mid Table Mediocrity
Visualising potential winners and promotion prospects in the Scottish Championship Continue reading Mid Table Mediocrity

More tidy evaluation with ggplot2
Another look at tidy evaluation with a slight twist on the previous post Continue reading More tidy evaluation with ggplot2

Tidily evaluated ggplot2
Test driving tidy evaluation in the new release of ggplot2 Continue reading Tidily evaluated ggplot2

Even Simpler SQL
A follow up post, with improved SQL and dplyr code Continue reading Even Simpler SQL

simpler SQL with dplyr
comparing dplyr with SQL nested queries - and there is only one winner Continue reading simpler SQL with dplyr

AphA Scotland - it's a thing now
Reflections on AphA Scotland launch event Continue reading AphA Scotland - it's a thing now

backed by data
Minimising the risk of delayed departure with process control charts Continue reading backed by data

No strings attached
creating a faceting function with bare variable names in ggplot2, base R and rlang Continue reading No strings attached

Theory free tidyeval
Getting our feet wet with dplyr programming and non standard evaluation Continue reading Theory free tidyeval

Enter Sa(n)dMan
Yet more Metallica sentiment analysis - wrapping up the last post with additional plots. Continue reading Enter Sa(n)dMan

Hardwired..for tidy text
using the genius and tidytext packages to perform sentiment and text analysis of Metallica’s song lyrics over time Continue reading Hardwired..for tidy text

Data Driven DIY - Hardwired...to Shelf Construct
Yes, I’m blogging about drilling a hole in the wall. Send help.. Continue reading Data Driven DIY - Hardwired...to Shelf Construct

Time To Shine
Blogging and social media for introverts - it CAN be done Continue reading Time To Shine

Let it flow, let it flow, let it flow......
Animating dot plots to demonstrate patient flow Continue reading Let it flow, let it flow, let it flow......

It's a dirty job, but someone's got to do it..
A tidytext analysis of Faith No More lyrics Continue reading It's a dirty job, but someone's got to do it..

Mapping to a 't'(map)
the tmap package <- beautiful static and interactive maps with R Continue reading Mapping to a 't'(map)

Simply Mapping
Using the simple features package (sf), dplyr and ggplot2 to map Scottish Index of Multiple Deprivation (SIMD) 2016 data Continue reading Simply Mapping

let there be progress
The ‘wrapr’ package for use with dplyr programming Continue reading let there be progress

The Run(chart)ing Man
Measurement for improvement in healthcare with R and Qlik Continue reading The Run(chart)ing Man

R to the Rescue
A strategy for gathering messy data scattered across several spreadsheets with R Continue reading R to the Rescue

The hourly heatmap with ggplot2
How I made the 24/7 heatmap from my previous post with ggplot2, dplyr and lubridate Continue reading The hourly heatmap with ggplot2

Daily metric tracking with ggplot2
Calendar style plots for multiple metrics over the same period with ggplot2 Continue reading Daily metric tracking with ggplot2

F is for Forecast
First steps with time series and prediction in R Continue reading F is for Forecast

Chart MakeoveR
Working out and restyling a chart with (geom) dumbbells Continue reading Chart MakeoveR

ggExtra is Extra useful
Amending scales on ggplots with easy to remember syntax Continue reading ggExtra is Extra useful