Publications by John MacKintosh

fwf without the faff

04.10.2021

Fixed width files? What are those? Well, imagine your entire dataframe/ tibble/ data.table is in a single column. That’s it, over 200 columns, in one. Each row is a very long string. Sounds fun right? Ideally, there would be delimiters ( you know, a few friendly commas between columns) to help you figure out where each new column starts. Or yo...

2736 sym R (131 sym/2 pcs) 4 img

Pass parameter to SQL Server DATEADD function using R

19.10.2021

I wanted to try and create some parameters in my flexdashboard script, so I could extract data from our warehouse over a flexible date range. In SQL Server, I’d create a variable and reference it like this: DECLARE @ndays int SET @ndays = -7 SELECT cols, that, I , want FROM [server].[schema].[table1] t1 LEFT JOIN [server].[schema].[table2] t2 O...

3875 sym R (1660 sym/4 pcs) 2 img

Scheduling Rmarkdown files on Windows – your foolproof guide

31.10.2021

You’ve written a great rmarkdown file, and now you want to run it at a set time every day. You’ve tried the Windows Task Scheduler, you’ve pointed it at your markdown file, and you’ve gone off to make some coffee safe in the knowledge that your outputs will be waiting for you when you get back to your desk… …Only they aren’t, becaus...

8274 sym R (564 sym/3 pcs) 12 img

cusumcharter available on CRAN

19.11.2021

I submitted my cusumcharter package to CRAN late last Friday evening and was pleasantly surprised to receive an email early on Monday advising me it was on its way to CRAN. Big thanks to the CRAN maintainers who manage to work through the queues of packages so quickly. The package has several functions aimed at making it easier to create CUSUM ch...

4736 sym R (1358 sym/1 pcs) 4 img

Shooting Stars

21.11.2021

This question popped up in my Twitter feed earlier, courtesy of @PipingHotData I did answer in a tweet, but I want to expand on that, so here goes.. Why would you follow someone on GitHub? I suppose the obvious one, at least for me, is that you like someone’s work – if I see someone has built 2 or 3 packages that I think are useful or intere...

9446 sym 12 img

I got my first package onto CRAN, and YOU CAN TOO

22.11.2021

It’s almost 2 weeks since I had my first package successfully submitted to CRAN. The runcharter package is special to me for lots of reasons – it was a tough problem to crack, and it’s one I’ve worked on with a variety of tools over the years. If this package had existed back in 2012, (and if I’d known what R was back then), my working...

3895 sym

I invented something better than wordclouds. True or False?

03.01.2022

The world’s going to pot. People who shouldn’t be in charge of jumble sales are in charge of countries, and billionaires are taking the words ‘intergalactic’ and ‘knob’ to new extremes, by flying big ones into space. For real. One way to escape the madness is to immerse yourself into the delightful world of Bob Mortimer, and more spec...

2481 sym 14 img

Enjoying the process of making tables in R using {reactable} and {reactablefmtr}

04.01.2022

I recently had to recreate a report which was originally produced in Excel. This is currently being converted to pdf and emailed out each morning. Initially I was thinking that a flexdashboard solution would be called for, but on seeing the report it was mainly tables, which the audience liked, and found informative. I have had zero interest in...

3352 sym R (1678 sym/1 pcs) 2 img

UK Energy company acquisitions – a great use case for Sankey plots

24.01.2022

Like many others in the ‘United’ Kingdom, I’ve found my energy supplier has gone bust, due to ongoing price hikes, and I’ve been moved over to another one, whom ordinarily I wouldn’t have signed up with. Fantastic. Because I’m not always sure you get the sarcasm How many folk have been affected by this sort of thing since the energy...

2100 sym R (2313 sym/7 pcs) 4 img

sankey_test

27.01.2022

“`r library(data.table) library(dplyr) library(tidyr) library(networkD3) library(htmlwidgets) library(widgetframe) data % rename(failed = `Failed_supplier`, acquired = `Acquired_by`) %>% mutate(year_acquired = lubridate::year(Date)) %>% relocate(year_acquired, .before = ‘Date’) %>% select(-Date) links % ...

1162 sym