Publications by HighlandR

On target

13.12.2022

Here are some notes on getting started with {targets}. The project I am working on involves several different reports, each at least 30 pages, and each with about 20 plots and 20 tables per document. As well as a myriad of functions, I had 7 very large R scripts doing the data munging and processing. I thought they were well ordered, but I had to...

3815 sym R (410 sym/2 pcs) 4 img

Dynamic schema, table and column names in SQL Server queries as a gateway to functional programming with R

05.04.2022

I’m looking into creating some functions to make it easier to carry out quality checks on our database tables. I’m using SQL Server, where tables are referred to in a [database].[schema].[tablename] format, although you can forgo some of this by using the USE statement – USE my_data_base GO Let’s say you want to run a simple query: SELEC...

2151 sym R (808 sym/7 pcs)

Iterating over multiple database tables with R

27.04.2022

You want to run a query over multiple tables in your database / warehouse and then process and visualise the combined results of those queries. You need to be able to switch between servers, databases, schemas and tables, selecting different columns and applying different conditions in the WHERE clause. You don’t have permsissions to write co...

4342 sym R (3633 sym/12 pcs)

Exploring your database with shiny

13.06.2022

Several of my recent blog posts have been focussed on using {purrr} and {glue} to programatically query a database. This is something I’d been wanting to achieve for some time, but my efforts got put on hold when COVID-19 came along. The general approach is to use a config file to denote the relevant tables and columns, along with the server an...

2561 sym

SIMD Revisited

16.07.2020

The Scottish Index of Multiple Deprivation updated for 2020 I have blogged about the SIMD previously. The last time was using data from 2016. Earlier this year, the data was refreshed, and my friend David Henderson was hot off the press with some very nice plots indeed. Even better, he’d shared his code, so I was tempted to quickly hop onto my...

3676 sym 20 img

ggExtra is Extra useful

03.04.2016

Amending plots with easy to remember syntax – I love ggplot2, but I struggle to remember some of the specific syntax I need to get my plots looking the way I want, especially those relating to making tweaks in the theme settings. Two of my most common changes are to rotate x axis labels, (so every date point is labeled), and removing ...

1614 sym R (228 sym/6 pcs)

ggExtra is Extra useful

03.04.2016

Amending plots with easy to remember syntax – I love ggplot2, but I struggle to remember some of the specific syntax I need to get my plots looking the way I want, especially those relating to making tweaks in the theme settings. Two of my most common changes are to rotate x axis labels, (so every date point is labeled), and removing ...

1832 sym

Chart MakeoveR

22.05.2016

Working out with (geom) dumbbells – The following chart appeared on my Twitter feed last week: There is quite a lot of information on there, but bar charts are not perhaps the best choice for visualising data over time. This is not to be critical – it gets a lot of data across in one plot, but I thought it would be interesting to ha...

5102 sym R (635 sym/3 pcs) 6 img

Chart MakeoveR

22.05.2016

Working out with (geom) dumbbells – The following chart appeared on my Twitter feed last week: There is quite a lot of information on there, but bar charts are not perhaps the best choice for visualising data over time. This is not to be critical – it gets a lot of data across in one plot, but I thought it would be interesting to ha...

5105 sym R (635 sym/3 pcs) 6 img

Intro to ggplot2

25.05.2016

Here is the link to a ggplot2 demo I presented at the InveRness RUG last week : intro to ggplot2 It’s in ioslides (html) format, for best viewing press F on your keyboard for full screen, and toggle widescreen on/off with the W key. It’s for beginners / those new to ggplot2. This is just scratching the surface of this amazing package. Hope t...

763 sym