Publications by HighlandR
Introducing popthemes
Back once again with the block rocking themes! Yes, having produced a set of R colour palettes based on Metallica album covers, and then another set of palettes based (loosely) on classic rock album covers, I’ve decided to complete the set with{popthemes} One problem with {rockthemes} is that I got carried away, and I have way more palettes tha...
4631 sym R (226 sym/11 pcs) 24 img
Introducing popthemes
Back once again with the block rocking themes! Yes, having produced a set of R colour palettes based on Metallica album covers, and then another set of palettes based (loosely) on classic rock album covers, I’ve decided to complete the set with {popthemes} One problem with {rockthemes} is that I got carried away, and I have way more palettes th...
4665 sym R (226 sym/11 pcs) 24 img
Cutting down code in dplyr and data.table
After a very long , R free hiatus (I don’t recommend it) I’m back on the R train, destination unknown. I had a bit of spare time last night, and remembered I had not done a PreppinData challenge for a while. In fact, the last one I did was week 8, and they are now on week 31 – the exact details of the challenge can been seen below. Preppin...
5257 sym R (2919 sym/8 pcs)
Cutting down code in dplyr and data.table
After a very long , R free hiatus (I don’t recommend it) I’m back on the R train, destination unknown. I had a bit of spare time last night, and remembered I had not done a PreppinData challenge for a while. In fact, the last one I did was week 8, and they are now on week 31 – the exact details of the challenge can been seen below. Preppin...
5257 sym R (2919 sym/8 pcs)
Well Well Well my Excel
Importing multiple excel files (not sheets, but files) and flattening into one data frame / tibble / data.table should be straightforward – shouldn’t it? How many ways can there be? What are the pros and cons of each? I’ve made three copies of an excel file from a PreppinData challenge. For this, I just want to import the first sheet from e...
2827 sym R (8042 sym/12 pcs)
Well Well Well my Excel
Importing multiple excel files (not sheets, but files) and flattening into one data frame / tibble / data.table should be straightforward – shouldn’t it? How many ways can there be? What are the pros and cons of each? I’ve made three copies of an excel file from a PreppinData challenge. For this, I just want to import the first sheet from e...
2933 sym R (8042 sym/12 pcs)
Calculating hotel occupancy with R
I saw a question on reddit today which can be answered using {patientcounter} The asker wants to know how to work out how many folk are in a hotel, at any given time, based on check in and check out dates. Here’s the setup: check_in_date <- c('2010-01-01', '2010-01-02' ,'2010-01-01', '2010-01-08', '2010-01-08', '2010-01-15',...
1033 sym R (2205 sym/3 pcs)
fwf without the faff
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...
2733 sym R (131 sym/2 pcs) 4 img
Pass parameter to SQL Server DATEADD function using R
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...
3872 sym R (1660 sym/4 pcs) 2 img
Scheduling Rmarkdown files on Windows – your foolproof guide
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...
8271 sym R (564 sym/3 pcs) 12 img