Publications by R - datawookie
Squares & Spirals
While trolling the internet aimlessly this morning, this TikTok video caught my attention. Your browser does not support the video tag. How difficult would it be to replicate that in R? # Add a new point. # # proportion - How far along the opposite edge should the new point be located? # next_point <- function(p, proportion = 0.1) { L <- le...
853 sym R (1885 sym/4 pcs) 6 img
Handling Empty Paragraphs from R Markdown
From time to time I find empty paragraph tags (<p></p>) inserted into my HTML when knitting an R Markdown document. Beyond being an affront to my OCD, these empty tags are mostly just an irritation. But if I’m trying to produce a very specific layout, then the extra space allocated to them can become a real annoyance. These tags seem to occur w...
1123 sym R (29 sym/1 pcs)
{emayili} Encrypted Email with Mailfence
In the previous post I ran through the process of setting up a Mailfence account for encrypting emails. In this post I show how Mailfence can be used with the {emayili} package for sending encrypted email from R. Create an account on Mailfence. If you want to use Mailfence with {emayili} (or another desktop email client), then you’ll need to ha...
2447 sym R (1052 sym/7 pcs) 4 img
Great Britain Railway Network
Introducing the nascent R package {blimey} (repository). At this stage it contains only the following data: railways — latitude and longitude segments along railway lines (wide format); railways_pivot — latitude and longitude segments along railway lines (long format); and railway_stations — codes, names and locations of railway stations. ...
1279 sym R (1716 sym/9 pcs) 6 img
Making Sense of Drug Prices
Drug pricing is complicated. In this post I take a look at reconciling ASP and WAC prices, focusing on normalising the WAC price per billing unit to achieve a price which is comparable to ASP. This post includes a number of case studies with the objective of laying out and testing a methodology for understanding and dealing with these data. There...
16028 sym R (20526 sym/39 pcs) 6 img
{emayili} Rendering R Markdown
In a previous post I documented a new feature in {emayili}, the ability to render Plain Markdown directly into the body of an email message. Today I’m announcing the release of a new minor version, 0.5.0, in which {emayili} is now able to render R Markdown into an email. This is a major leap forward for the package. I should mention that this c...
1007 sym R (861 sym/6 pcs) 2 img
{emayili} R Markdown Parameters
I don’t frequently use parameters in R Markdown documents. So the initial implementation of render() in {emayili} did not cater for them. A small tweak makes it possible though. You can install the update from GitHub as follows. remotes::install_github("datawookie/emayili", ref = "v0.5.2") Then load the package. library(emayili) # A couple of ...
1147 sym R (1661 sym/6 pcs) 2 img
{emayili} Managing CSS
I love the clean simplicity of an R Markdown document. But sometimes it can feel a little bare and utilitarian. This is especially the case if it’s rendered into the body of an email. How about injecting a little more pizzazz? library(emayili) Check on the installed version. packageVersion("emayili") [1] '0.5.3' And create an empty message obj...
2076 sym R (705 sym/6 pcs) 12 img
{emayili} Right-to-Left
Yoav Raskin suggested that it would be useful to support right-to-left (RTL) text in {emayili}, so that languages like Hebrew, Arabic and Aramaic would render properly. I’ll be honest, this was not something that I had previously considered. But agreed, it would be a cool feature. library(emayili) packageVersion("emayili") [1] '0.5.5' RTL in...
1869 sym R (1705 sym/5 pcs) 8 img
{emayili} Styling Figures
By default <img> tags are wrapped in a tight <p></p> embrace by {knitr}. In general this works really well. However, I want to have more control over image formatting for {emayili}. Adding a Hook I’d like to have the <img> tags wrapped by <figure></figure>. It’d also be useful to have the option of inserting a <figcaption>. To support these ...
1885 sym R (545 sym/4 pcs) 12 img