<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>chemo.org.uk</title>
<link>https://www.chemo.org.uk/</link>
<atom:link href="https://www.chemo.org.uk/index.xml" rel="self" type="application/rss+xml"/>
<description>discussing oncology pharmacy, data manipulation and other general thoughts
</description>
<generator>quarto-1.5.56</generator>
<lastBuildDate>Sat, 10 May 2025 23:00:00 GMT</lastBuildDate>
<item>
  <title>White Axes, line labels and transparency in Survival Curves</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/TransparentSurvivalCurves.html</link>
  <description><![CDATA[ 





<section id="background" class="level2">
<h2 class="anchored" data-anchor-id="background">Background</h2>
<p>I don’t know if I’m actually going to use the results of this yet, but having spent more time than I’d hoped to trying to figure out how to do this, I thought I should document it. I’m producing a survival curve using <a href="https://rpkgs.datanovia.com/survminer/reference/ggsurvplot.html">ggsurvplot</a>, but I want to present them on a dark background. That means I want to make my plot background transparent and make all the black stuff (lines, text etc) white so that it has good contrast on the dark background. I’ve almost never seen examples of this in the wild - either because in design terms someone says its a bad thing, /or/ its hard to do in R so people don’t try?</p>
<p>I’ve read enough data science blogs to know that having to move your eyes from a line to a legend to work out which one is which is also considered bad, and so I’m also going to label my lines.</p>
</section>
<section id="lets-set-up-a-basic-plot" class="level2">
<h2 class="anchored" data-anchor-id="lets-set-up-a-basic-plot">Lets set up a basic plot</h2>
<p>My plots have risk tables on them which makes life all the more ‘exciting’. We will start with the official example plot - survival in the lung cancer data-set. I’ve made some tweaks to the standard off the shelf plot to get us started.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-1" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(survival)</span>
<span id="annotated-cell-1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(survminer)</span>
<span id="annotated-cell-1-3">fit<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">survfit</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> sex, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung)</span>
<span id="annotated-cell-1-4"></span>
<span id="annotated-cell-1-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Basic survival curves</span></span>
<span id="annotated-cell-1-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-1-7">    fit, </span>
<span id="annotated-cell-1-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung, </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-1-9" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-1-10" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="3" onclick="event.preventDefault();">3</a><span id="annotated-cell-1-11" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="4" onclick="event.preventDefault();">4</a><span id="annotated-cell-1-12" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="5" onclick="event.preventDefault();">5</a><span id="annotated-cell-1-13" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span></span>
<span id="annotated-cell-1-14">    )</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-1" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="9" data-code-annotation="1">Add a title</span>
</dd>
<dt data-target-cell="annotated-cell-1" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="10" data-code-annotation="2">Change the colours for the two survival lines</span>
</dd>
<dt data-target-cell="annotated-cell-1" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="11" data-code-annotation="3">Add a p-value annotation to the plot</span>
</dd>
<dt data-target-cell="annotated-cell-1" data-target-annotation="4">4</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="12" data-code-annotation="4">Add the risk table below the plot</span>
</dd>
<dt data-target-cell="annotated-cell-1" data-target-annotation="5">5</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="13" data-code-annotation="5">Set the risk table to be 20% of the plot height.</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-1-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="now-to-customise-that-plot-theme" class="level2">
<h2 class="anchored" data-anchor-id="now-to-customise-that-plot-theme">Now to customise that plot theme</h2>
<p><a href="https://rpkgs.datanovia.com/survminer/reference/ggsurvplot.html">ggsurvplot</a> works using ggplot and so you might expect that you can take its result and throw a few theme() statements at it and magically make things look different. Of course if it was that easy, I’d not be writing a blog about it! <a href="https://rpkgs.datanovia.com/survminer/reference/ggsurvplot.html">ggsurvplot</a> knows this is an issue so it lets you define the theme /within/ the call to the plot. The reason this strange approach is used, is that <a href="https://rpkgs.datanovia.com/survminer/reference/ggsurvplot.html">ggsurvplot</a> is actually creating <em>two</em> plots - the risk table is a plot as well.</p>
<p>So for simplicity, lets say I wanted to change the axis to be red and a bit thicker I can use this:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-2" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-2-2">    fit, </span>
<span id="annotated-cell-2-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-2-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-2-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-2-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-2-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-2-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-2" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-2-9" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="annotated-cell-2-10">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>),</span>
<span id="annotated-cell-2-11">                        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>),</span>
<span id="annotated-cell-2-12">                        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>)</span>
<span id="annotated-cell-2-13">                     ) </span>
<span id="annotated-cell-2-14">    )</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-2" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-2" data-code-lines="9,10,11,12" data-code-annotation="1">Add a theme statement to change the axis.line to red, and the tick colour, width and length.</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-2-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>This is all fairly well documented and straightforward so far. And we can add a transparent background using the theme_transparent() in the ggtheme statement.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-3" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-3-2">    fit, </span>
<span id="annotated-cell-3-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-3-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-3-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-3-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-3-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-3-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-3" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-3-9" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_transparent</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="annotated-cell-3-10">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( </span>
<span id="annotated-cell-3-11">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), </span>
<span id="annotated-cell-3-12">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>), </span>
<span id="annotated-cell-3-13">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>) </span>
<span id="annotated-cell-3-14">                        ) </span>
<span id="annotated-cell-3-15">    )</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-3" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-3" data-code-lines="9" data-code-annotation="1">Add a theme_transparent statement much like you would with ggplot2 normally, but within the ggtheme statement.</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-3-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>If you’ve not already got dark mode enabled on the site, now might be a good time to enable it! You can use the slider at the top right of the screen. However, already there are a few things that even then aren’t behaving as you might expect! The title has vanished. The tick-marks (on the main plot) are in black not red and my decision to thicken the axis has suddenly made the risk table axis really obvious. You can add a tables.theme statement as well which would let you handle its axis differently. I’m also going to switch off the text labels with - tables.y.text = FALSE.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-4" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-4-2">    fit, </span>
<span id="annotated-cell-4-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-4-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-4-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-4-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-4-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-4-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-4" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-4-9" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.y.text =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>,</span>
<span id="annotated-cell-4-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_transparent</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-4" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-4-11" class="code-annotation-target">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"yellow"</span>),</span>
<span id="annotated-cell-4-12">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-4" data-target-annotation="3" onclick="event.preventDefault();">3</a><span id="annotated-cell-4-13" class="code-annotation-target">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>),</span>
<span id="annotated-cell-4-14">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>),</span>
<span id="annotated-cell-4-15">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>) </span>
<span id="annotated-cell-4-16">                        ), </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-4" data-target-annotation="4" onclick="event.preventDefault();">4</a><span id="annotated-cell-4-17" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.theme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_cleantable</span>()</span>
<span id="annotated-cell-4-18">    )</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-4" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-4" data-code-lines="9" data-code-annotation="1">Removing the text labels just for tidiness</span>
</dd>
<dt data-target-cell="annotated-cell-4" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-4" data-code-lines="11" data-code-annotation="2">Make the text a different colour. When I’m experimenting with graphs like this I often use a mix of horrible colours to check what I’m changing, then flip to my final colour I want later.</span>
</dd>
<dt data-target-cell="annotated-cell-4" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-4" data-code-lines="13,14" data-code-annotation="3">Specify the axis ticks for x and y separately as they must be defined separately elsewhere in the ggsurvplot theme :-(</span>
</dd>
<dt data-target-cell="annotated-cell-4" data-target-annotation="4">4</dt>
<dd>
<span data-code-cell="annotated-cell-4" data-code-lines="17" data-code-annotation="4">Adding a different theme to the risk table</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-4-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>You will notice we still have black text on the p value and the risk numbers and that we are still missing the title and the title on the risk table. The title is fairly easy to fix. The black text for the p-value is however not so simple. These bits of text are actually geom_text and the colour is specified when they are placed rather than using a theme. ggsurvplot has provided a method for the numbers at risk so we can use that.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-5" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-5-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-5-2">    fit, </span>
<span id="annotated-cell-5-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-5-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-5-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-5-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-5-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-5-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<span id="annotated-cell-5-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.y.text =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>, </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-5" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-5-10" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"magenta"</span>,</span>
<span id="annotated-cell-5-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_transparent</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="annotated-cell-5-12">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"yellow"</span>), </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-5" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-5-13" class="code-annotation-target">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>),</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-5" data-target-annotation="3" onclick="event.preventDefault();">3</a><span id="annotated-cell-5-14" class="code-annotation-target">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.tag=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"orange"</span>),</span>
<span id="annotated-cell-5-15">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>),</span>
<span id="annotated-cell-5-16">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), </span>
<span id="annotated-cell-5-17">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>), </span>
<span id="annotated-cell-5-18">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>), </span>
<span id="annotated-cell-5-19">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>) </span>
<span id="annotated-cell-5-20">                        ), </span>
<span id="annotated-cell-5-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.theme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_cleantable</span>() </span>
<span id="annotated-cell-5-22">    )</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-5" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-5" data-code-lines="10" data-code-annotation="1">Use tables.col to specify the text colour, or alternatively you could use tables.col = “strata” to get the line colours as the text colour.</span>
</dd>
<dt data-target-cell="annotated-cell-5" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-5" data-code-lines="13" data-code-annotation="2">Specifying a plot title, and in this example a size will restore the title.</span>
</dd>
<dt data-target-cell="annotated-cell-5" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-5" data-code-lines="14,15" data-code-annotation="3">If you are using a subtitle, or plot tags you will need to specify these too.</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-5-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>If you’d like the Number at Risk to be smaller and on the left we can add it as a theme to tables.theme()</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-6" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-6-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-6-2">    fit, </span>
<span id="annotated-cell-6-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-6-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-6-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-6-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-6-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-6-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<span id="annotated-cell-6-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.y.text =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>, </span>
<span id="annotated-cell-6-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"magenta"</span>,</span>
<span id="annotated-cell-6-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_transparent</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="annotated-cell-6-12">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"yellow"</span>), </span>
<span id="annotated-cell-6-13">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>), </span>
<span id="annotated-cell-6-14">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.tag=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"orange"</span>), </span>
<span id="annotated-cell-6-15">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>), </span>
<span id="annotated-cell-6-16">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), </span>
<span id="annotated-cell-6-17">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>), </span>
<span id="annotated-cell-6-18">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>), </span>
<span id="annotated-cell-6-19">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>) </span>
<span id="annotated-cell-6-20">                        ), </span>
<span id="annotated-cell-6-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.theme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_cleantable</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="annotated-cell-6-22">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-6" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-6-23" class="code-annotation-target">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> )</span>
<span id="annotated-cell-6-24">            )</span>
<span id="annotated-cell-6-25">    )</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-6" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-6" data-code-lines="23" data-code-annotation="1">Reduce the size and horizontally justify (left align) the title</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-6-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="hacking-the-p-value-colour" class="level2">
<h2 class="anchored" data-anchor-id="hacking-the-p-value-colour">Hacking the p-value colour</h2>
<p>We’ve now done as much as we can achieve within ggsurvplot directly. So lets plot this all with white instead of all these hideous colours. We will save this as an object so that we can hack the p value colour.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-7" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-7-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">par</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">bg =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#000000"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fg =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#FFFFFF"</span>)</span>
<span id="annotated-cell-7-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-7-3">    fit, </span>
<span id="annotated-cell-7-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-7-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-7-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-7-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-7-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-7-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<span id="annotated-cell-7-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.y.text =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>, </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-7" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-7-11" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>,</span>
<span id="annotated-cell-7-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_transparent</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="annotated-cell-7-13">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>),</span>
<span id="annotated-cell-7-14">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>),</span>
<span id="annotated-cell-7-15">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.tag=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>),</span>
<span id="annotated-cell-7-16">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>),</span>
<span id="annotated-cell-7-17">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>),</span>
<span id="annotated-cell-7-18">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>),</span>
<span id="annotated-cell-7-19">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>),</span>
<span id="annotated-cell-7-20">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>) </span>
<span id="annotated-cell-7-21">                        ), </span>
<span id="annotated-cell-7-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.theme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_cleantable</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="annotated-cell-7-23">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( </span>
<span id="annotated-cell-7-24">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> )</span>
<span id="annotated-cell-7-25">            )</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-7" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-7-26" class="code-annotation-target">    ) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> myPlot</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-7" data-target-annotation="3" onclick="event.preventDefault();">3</a><span id="annotated-cell-7-27" class="code-annotation-target"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(myPlot)</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-7" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-7" data-code-lines="11,13,14,15,16,17,18,19,24" data-code-annotation="1">Change all the colours to white</span>
</dd>
<dt data-target-cell="annotated-cell-7" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-7" data-code-lines="26" data-code-annotation="2">Save the plot to an object called myPlot</span>
</dd>
<dt data-target-cell="annotated-cell-7" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-7" data-code-lines="27" data-code-annotation="3">Use print to view the plot</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-7-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>If we now examine the structure of myPlot with summary(myPlot) we get:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(myPlot)</span></code></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>               Length Class      Mode
plot           11     gg         list
table          11     gg         list
data.survplot  10     data.frame list
data.survtable 10     data.frame list</code></pre>
</div>
</div>
<p>Which tells us there is 4 parts to this object. Two data tables containing the data, and two gg class objects (plots in essence) once called ‘plot’ which has the survival curve, the other ‘table’ which has the risk table. Examining the plot will give us more information:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot)</span></code></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>data: time, n.risk, n.event, n.censor, surv, std.err, upper, lower,
  strata, sex [208x10]
mapping:  x = ~time, y = ~surv
scales:   y, ymin, ymax, yend, yintercept, ymin_final, ymax_final, lower, middle, upper, y0, colour, fill, x, xmin, xmax, xend, xintercept, xmin_final, xmax_final, xlower, xmiddle, xupper, x0 
faceting: &lt;ggproto object: Class FacetNull, Facet, gg&gt;
    compute_layout: function
    draw_back: function
    draw_front: function
    draw_labels: function
    draw_panels: function
    finish_data: function
    init_scales: function
    map_data: function
    params: list
    setup_data: function
    setup_params: function
    shrink: TRUE
    train_scales: function
    vars: function
    super:  &lt;ggproto object: Class FacetNull, Facet, gg&gt;
-----------------------------------
mapping: colour = ~strata 
geom_step: direction = hv, na.rm = FALSE
stat_identity: na.rm = FALSE
position_identity 

mapping: x = ~x, y = ~y 
geom_blank: na.rm = FALSE
stat_identity: na.rm = FALSE
position_identity 

mapping: colour = ~strata 
geom_point: na.rm = FALSE
stat_identity: na.rm = FALSE
position_identity 

mapping: x = ~x, y = ~y 
geom_text: na.rm = FALSE
stat_identity: na.rm = FALSE
position_identity </code></pre>
</div>
</div>
<p>This shows there are 4 parts to this particular plot (your plots may vary!). Importantly the 4th part is geom_text - this likely contains our p-value information. These sit in something called a layer and we should look at the 4th Layer. We are interested in the aesthetics so we need to look at the aes_params:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>layers[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>]]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>aes_params</span></code></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>$label
[1] "p = 0.0013"

$size
[1] 5

$hjust
[1] 0

$family
[1] ""</code></pre>
</div>
</div>
<p>This confirms we are looking that p-value and shows that no colour has been specified. Adding a colour is as easy as:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>layers[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>]]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>aes_params<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>colour <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span></span>
<span id="cb7-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(myPlot)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-11-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="labelling-the-line-instead-of-a-legend" class="level2">
<h2 class="anchored" data-anchor-id="labelling-the-line-instead-of-a-legend">Labelling the line instead of a legend</h2>
<p>I also wanted to edit the legend to annotate those alongside my lines rather than at the top of the window as a legend. We should therefore return to our ggsurvplot command to disable the legend:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-12" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-12-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-12-2">    fit, </span>
<span id="annotated-cell-12-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-12-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-12-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-12-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-12" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-12-7" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>,</span>
<span id="annotated-cell-12-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-12-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<span id="annotated-cell-12-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.y.text =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>, </span>
<span id="annotated-cell-12-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>,</span>
<span id="annotated-cell-12-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_transparent</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="annotated-cell-12-13">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>), </span>
<span id="annotated-cell-12-14">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>), </span>
<span id="annotated-cell-12-15">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.tag=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>), </span>
<span id="annotated-cell-12-16">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>),</span>
<span id="annotated-cell-12-17">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), </span>
<span id="annotated-cell-12-18">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>),</span>
<span id="annotated-cell-12-19">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>), </span>
<span id="annotated-cell-12-20">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>) </span>
<span id="annotated-cell-12-21">                        ), </span>
<span id="annotated-cell-12-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.theme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_cleantable</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="annotated-cell-12-23">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( </span>
<span id="annotated-cell-12-24">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> ) </span>
<span id="annotated-cell-12-25">            )</span>
<span id="annotated-cell-12-26">    ) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> myPlot </span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-12" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-12-27" class="code-annotation-target">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>layers[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>]]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>aes_params<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>colour <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span></span>
<span id="annotated-cell-12-28"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(myPlot) </span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-12" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-12" data-code-lines="7,11" data-code-annotation="1">Disable the legend</span>
</dd>
<dt data-target-cell="annotated-cell-12" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-12" data-code-lines="27" data-code-annotation="2">Update the p-value colour</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-12-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>As myPlot$plot contains the survival curve we can use ggannotate to, erm, annotate it! Strata are ordered in the order of the factor for their grouping. So in our example at the very start we created a survival object with:</p>
<pre><code>fit&lt;- survfit(Surv(time, status) ~ sex, data = lung)</code></pre>
<p>and ‘sex’ is where the strata comes from. Unhelpfully they are coded as sex = 1 or 2. I gather that the correct allocation is 1 = Male and 2 = Female. It would probably be better to fix this <em>before</em> we create the survival object. So lets go back and do that:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-14" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><a class="code-annotation-anchor" data-target-cell="annotated-cell-14" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-14-1" class="code-annotation-target"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(forcats)</span>
<span id="annotated-cell-14-2"></span>
<span id="annotated-cell-14-3">lung<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>sex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-14" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-14-4" class="code-annotation-target">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.character</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-14" data-target-annotation="3" onclick="event.preventDefault();">3</a><span id="annotated-cell-14-5" class="code-annotation-target">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_recode</span> ( <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2"</span>) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> lung<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>sex</span>
<span id="annotated-cell-14-6"></span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-14" data-target-annotation="4" onclick="event.preventDefault();">4</a><span id="annotated-cell-14-7" class="code-annotation-target">fit<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">survfit</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> sex, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung)</span>
<span id="annotated-cell-14-8"></span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-14" data-target-annotation="5" onclick="event.preventDefault();">5</a><span id="annotated-cell-14-9" class="code-annotation-target"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-14-10">    fit,</span>
<span id="annotated-cell-14-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-14-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<span id="annotated-cell-14-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>),</span>
<span id="annotated-cell-14-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-14-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-14-16">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<span id="annotated-cell-14-17">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.y.text =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span></span>
<span id="annotated-cell-14-18">    )</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-14" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-14" data-code-lines="1" data-code-annotation="1">I prefer to use tidyverse forcats package for factors, but you could use base R to achieve the same</span>
</dd>
<dt data-target-cell="annotated-cell-14" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-14" data-code-lines="4" data-code-annotation="2">The data is currently stored as a number and not a factor. forcats can’t process a number it needs a character or factor so lets make it a character</span>
</dd>
<dt data-target-cell="annotated-cell-14" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-14" data-code-lines="5" data-code-annotation="3">Re-code the data and save it back into the lung$sex data column. You could of course save it elsewhere and use that if you didn’t want to affect the source data</span>
</dd>
<dt data-target-cell="annotated-cell-14" data-target-annotation="4">4</dt>
<dd>
<span data-code-cell="annotated-cell-14" data-code-lines="7" data-code-annotation="4">Refit the data with the coded values</span>
</dd>
<dt data-target-cell="annotated-cell-14" data-target-annotation="5">5</dt>
<dd>
<span data-code-cell="annotated-cell-14" data-code-lines="9,10,11,12,13,14,15,16,17,18" data-code-annotation="5">Re run the graph, I’ve used a shortened version here with the legend re-enabled to show which is which for colours - yellow is male and blue is female</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-13-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>To annotate the graphs we will need to know:</p>
<ul>
<li>Where we want the labels to be</li>
<li>The label colours</li>
<li>The label names</li>
</ul>
<p>The label colours is ‘easy’ we are already defining that with the line palette = c(“#E7B800”, “#2E9FDF”) in the plot and it would be sensible to use labels of the same colour as the line.</p>
<p>The label names is also ‘easy’ as we simply need to take the factor levels. These will be applied to the colours in order. So the first factor gets #E7B800 as a colour.</p>
<p>Positioning by code is harder. You may simply decide to do it using some hard entered numbers of the co-ordinates you want to use. But I thought this little bit of code might work:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-15" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><a class="code-annotation-anchor" data-target-cell="annotated-cell-15" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-15-1" class="code-annotation-target">line_colours <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>)</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-15" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-15-2" class="code-annotation-target">label_names <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">levels</span>(lung<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>sex)</span>
<span id="annotated-cell-15-3"></span>
<span id="annotated-cell-15-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Get the lower line name</span></span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-15" data-target-annotation="3" onclick="event.preventDefault();">3</a><span id="annotated-cell-15-5" class="code-annotation-target">lower_line <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">min</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">na.rm=</span>T)]</span>
<span id="annotated-cell-15-6">upper_line <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">na.rm=</span>T)]</span>
<span id="annotated-cell-15-7"></span>
<span id="annotated-cell-15-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># establish 75% of x-axis</span></span>
<span id="annotated-cell-15-9">sum_fit <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit)</span>
<span id="annotated-cell-15-10">x75 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>time, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">na.rm=</span>T) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.75</span></span>
<span id="annotated-cell-15-11"></span>
<span id="annotated-cell-15-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># get the lower line level at 75% of the way along the line</span></span>
<span id="annotated-cell-15-13">lower_line_y <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>surv[sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> x75 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> lower_line][<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="annotated-cell-15-14"></span>
<span id="annotated-cell-15-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># get the upper line level at 75% of the way along the line</span></span>
<span id="annotated-cell-15-16">upper_line_y <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>surv[sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> x75 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> upper_line][<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="annotated-cell-15-17"></span>
<span id="annotated-cell-15-18"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># annotate the lower line with the right hand to corner of the label at 75% &amp; lower_line (with some padding)</span></span>
<span id="annotated-cell-15-19"></span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-15" data-target-annotation="4" onclick="event.preventDefault();">4</a><span id="annotated-cell-15-20" class="code-annotation-target">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>(</span>
<span id="annotated-cell-15-21">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text"</span>,</span>
<span id="annotated-cell-15-22">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span> x75,</span>
<span id="annotated-cell-15-23">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> lower_line_y,</span>
<span id="annotated-cell-15-24">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span> label_names[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>lower_line],</span>
<span id="annotated-cell-15-25">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span>line_colours[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>lower_line],</span>
<span id="annotated-cell-15-26">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="annotated-cell-15-27">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">vjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="annotated-cell-15-28">            )</span>
<span id="annotated-cell-15-29"></span>
<span id="annotated-cell-15-30"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># annotate the upper line above the line</span></span>
<span id="annotated-cell-15-31"></span>
<span id="annotated-cell-15-32">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>(</span>
<span id="annotated-cell-15-33">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text"</span>,</span>
<span id="annotated-cell-15-34">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span> x75,</span>
<span id="annotated-cell-15-35">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> upper_line_y,</span>
<span id="annotated-cell-15-36">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span> label_names[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>upper_line],</span>
<span id="annotated-cell-15-37">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span>line_colours[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>upper_line],</span>
<span id="annotated-cell-15-38">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="annotated-cell-15-39">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">vjust =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># this is a bit unpredictable</span></span>
<span id="annotated-cell-15-40">            )</span>
<span id="annotated-cell-15-41"></span>
<span id="annotated-cell-15-42"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(myPlot)</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-15" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-15" data-code-lines="1" data-code-annotation="1">define the line colours as a vector</span>
</dd>
<dt data-target-cell="annotated-cell-15" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-15" data-code-lines="2" data-code-annotation="2">define the label names for the graph</span>
</dd>
<dt data-target-cell="annotated-cell-15" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-15" data-code-lines="5,6,9,10,13,16" data-code-annotation="3">establish where to plot the annotations</span>
</dd>
<dt data-target-cell="annotated-cell-15" data-target-annotation="4">4</dt>
<dd>
<span data-code-cell="annotated-cell-15" data-code-lines="20,21,22,23,24,25,26,27,28,32,33,34,35,36,37,38,39,40" data-code-annotation="4">plot the annotations</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-14-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>For completeness - we can create this all as a single piece of code, and we will replace the line colouration inf the ggsurvplot function so that it couldn’t be swapped around in error.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="annotated-cell-16" style="background: #f1f3f5;"><pre class="sourceCode r code-annotation-code code-with-copy code-annotated"><code class="sourceCode r"><span id="annotated-cell-16-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(survival)</span>
<span id="annotated-cell-16-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(survminer)</span>
<span id="annotated-cell-16-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(forcats)</span>
<span id="annotated-cell-16-4"></span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-16" data-target-annotation="1" onclick="event.preventDefault();">1</a><span id="annotated-cell-16-5" class="code-annotation-target"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data</span>(lung)</span>
<span id="annotated-cell-16-6"></span>
<span id="annotated-cell-16-7">lung<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>sex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="annotated-cell-16-8">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.character</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="annotated-cell-16-9">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_recode</span> ( <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2"</span>) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> lung<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>sex </span>
<span id="annotated-cell-16-10"></span>
<span id="annotated-cell-16-11">fit<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">survfit</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> sex, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung) </span>
<span id="annotated-cell-16-12"></span>
<span id="annotated-cell-16-13">line_colours <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#E7B800"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2E9FDF"</span>)  </span>
<span id="annotated-cell-16-14">label_names <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">levels</span>(lung<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>sex) </span>
<span id="annotated-cell-16-15"></span>
<span id="annotated-cell-16-16"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsurvplot</span>(</span>
<span id="annotated-cell-16-17">    fit, </span>
<span id="annotated-cell-16-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> lung,</span>
<span id="annotated-cell-16-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The official example Survival Curve"</span>,</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-16" data-target-annotation="2" onclick="event.preventDefault();">2</a><span id="annotated-cell-16-20" class="code-annotation-target">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">palette =</span> line_colours,</span>
<span id="annotated-cell-16-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pval =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-16-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>, </span>
<span id="annotated-cell-16-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">risk.table =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>,</span>
<span id="annotated-cell-16-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>,</span>
<span id="annotated-cell-16-25">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.y.text =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>, </span>
<span id="annotated-cell-16-26">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, </span>
<span id="annotated-cell-16-27">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ggtheme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_transparent</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="annotated-cell-16-28">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>), </span>
<span id="annotated-cell-16-29">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>), </span>
<span id="annotated-cell-16-30">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.tag=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>), </span>
<span id="annotated-cell-16-31">                                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>),</span>
<span id="annotated-cell-16-32">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.line =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), </span>
<span id="annotated-cell-16-33">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>),</span>
<a class="code-annotation-anchor" data-target-cell="annotated-cell-16" data-target-annotation="3" onclick="event.preventDefault();">3</a><span id="annotated-cell-16-34" class="code-annotation-target">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>),</span>
<span id="annotated-cell-16-35">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>),</span>
<span id="annotated-cell-16-36">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>), </span>
<span id="annotated-cell-16-37">                            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks.length=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>) </span>
<span id="annotated-cell-16-38">                        ), </span>
<span id="annotated-cell-16-39">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tables.theme =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_cleantable</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="annotated-cell-16-40">            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>( </span>
<span id="annotated-cell-16-41">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> ) </span>
<span id="annotated-cell-16-42">            )</span>
<span id="annotated-cell-16-43">    ) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> myPlot </span>
<span id="annotated-cell-16-44"></span>
<span id="annotated-cell-16-45"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># change the p-value colour</span></span>
<span id="annotated-cell-16-46">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>layers[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>]]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>aes_params<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>colour <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span> </span>
<span id="annotated-cell-16-47"></span>
<span id="annotated-cell-16-48"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Get the lower line name</span></span>
<span id="annotated-cell-16-49">lower_line <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">min</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">na.rm=</span>T)] </span>
<span id="annotated-cell-16-50">upper_line <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>median, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">na.rm=</span>T)] </span>
<span id="annotated-cell-16-51"></span>
<span id="annotated-cell-16-52"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># establish 75% of x-axis</span></span>
<span id="annotated-cell-16-53">sum_fit <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit) </span>
<span id="annotated-cell-16-54">x75 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>time, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">na.rm=</span>T) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.75</span> </span>
<span id="annotated-cell-16-55"></span>
<span id="annotated-cell-16-56"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># get the lower line level at 75% of the way along the line</span></span>
<span id="annotated-cell-16-57">lower_line_y <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>surv[sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> x75 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> lower_line][<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>] </span>
<span id="annotated-cell-16-58"></span>
<span id="annotated-cell-16-59"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># get the upper line level at 75% of the way along the line</span></span>
<span id="annotated-cell-16-60">upper_line_y <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>surv[sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> x75 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> sum_fit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> upper_line][<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>] </span>
<span id="annotated-cell-16-61"></span>
<span id="annotated-cell-16-62"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># annotate the lower line with the right hand to corner of the label at 75% &amp; lower_line (with some padding)</span></span>
<span id="annotated-cell-16-63"></span>
<span id="annotated-cell-16-64">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>( </span>
<span id="annotated-cell-16-65">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text"</span>, </span>
<span id="annotated-cell-16-66">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span> x75, </span>
<span id="annotated-cell-16-67">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> lower_line_y, </span>
<span id="annotated-cell-16-68">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span> label_names[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>lower_line], </span>
<span id="annotated-cell-16-69">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span>line_colours[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>lower_line],</span>
<span id="annotated-cell-16-70">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="annotated-cell-16-71">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">vjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="annotated-cell-16-72">            )</span>
<span id="annotated-cell-16-73"></span>
<span id="annotated-cell-16-74"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># annotate the upper line above the line</span></span>
<span id="annotated-cell-16-75"></span>
<span id="annotated-cell-16-76">myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> myPlot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>plot <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>(</span>
<span id="annotated-cell-16-77">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text"</span>,</span>
<span id="annotated-cell-16-78">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span> x75, </span>
<span id="annotated-cell-16-79">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> upper_line_y, </span>
<span id="annotated-cell-16-80">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span> label_names[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>upper_line], </span>
<span id="annotated-cell-16-81">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour=</span>line_colours[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">surv_median</span>(fit)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>strata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span>upper_line],</span>
<span id="annotated-cell-16-82">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="annotated-cell-16-83">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">vjust =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># this is a bit unpredictable </span></span>
<span id="annotated-cell-16-84">            )</span>
<span id="annotated-cell-16-85"></span>
<span id="annotated-cell-16-86"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(myPlot)</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div>
</details>
<div class="cell-annotation">
<dl class="code-annotation-container-grid">
<dt data-target-cell="annotated-cell-16" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-16" data-code-lines="5" data-code-annotation="1">reload the lung data-set as we’ve been messing with it</span>
</dd>
<dt data-target-cell="annotated-cell-16" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-16" data-code-lines="20" data-code-annotation="2">insert the line colour vector</span>
</dd>
<dt data-target-cell="annotated-cell-16" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-16" data-code-lines="34,35" data-code-annotation="3">expose the axis labels which I missed earlier!</span>
</dd>
</dl>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><embed src="TransparentSurvivalCurves_files/figure-html/unnamed-chunk-15-1.pdf" class="img-fluid" width="768"></p>
</figure>
</div>
</div>
</div>
<p>Finally, if we want to save the plot as a vector or png, we need to tell ggsave not to apply a background colour!</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsave</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"myPlot.png"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">bg=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"transparent"</span>)</span></code></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Saving 8 x 8 in image</code></pre>
</div>
</div>
<div class="cell">
<div class="cell-output-display">
<p>We used R version 4.3.0<span class="citation" data-cites="base"><sup>[1]</sup></span> and the following R packages: cowplot v. 1.1.3<span class="citation" data-cites="cowplot"><sup>[2]</sup></span>, DT v. 0.33<span class="citation" data-cites="DT"><sup>[3]</sup></span>, glue v. 1.8.0<span class="citation" data-cites="glue"><sup>[4]</sup></span>, knitr v. 1.50<span class="citation" data-cites="knitr2014 knitr2015 knitr2025"><sup>[5–7]</sup></span>, qicharts2 v. 0.7.5<span class="citation" data-cites="qicharts2"><sup>[8]</sup></span>, rmarkdown v. 2.29<span class="citation" data-cites="rmarkdown2018 rmarkdown2020 rmarkdown2024"><sup>[9–11]</sup></span>, survival v. 3.8.3<span class="citation" data-cites="survival2000 survival2024"><sup>[12,13]</sup></span>, survminer v. 0.5.0<span class="citation" data-cites="survminer"><sup>[14]</sup></span>, tidyverse v. 2.0.0<span class="citation" data-cites="tidyverse"><sup>[15]</sup></span>.</p>
</div>
</div>


</section>
<section id="bibliography" class="level1 unnumbered">


</section>

<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
<p><a class="a2a_dd" href="https://www.addtoany.com/share"></a> <a class="a2a_button_mastodon"></a> <a class="a2a_button_email"></a> <a class="a2a_button_bluesky"></a> <a class="a2a_button_linkedin"></a> <a class="a2a_button_copy_link"></a></p>
</div><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-base" class="csl-entry">
1. R Core Team. (2023). <em><span>R</span>: A language and environment for statistical computing</em>. R Foundation for Statistical Computing. <a href="https://www.R-project.org/">https://www.R-project.org/</a>
</div>
<div id="ref-cowplot" class="csl-entry">
2. Wilke, C. O. (2024). <em><span class="nocase">cowplot</span>: Streamlined plot theme and plot annotations for <span>“<span class="nocase">ggplot2</span>”</span></em>. <a href="https://CRAN.R-project.org/package=cowplot">https://CRAN.R-project.org/package=cowplot</a>
</div>
<div id="ref-DT" class="csl-entry">
3. Xie, Y., Cheng, J., &amp; Tan, X. (2024). <em><span>DT</span>: A wrapper of the JavaScript library <span>“<span>DataTables</span>”</span></em>. <a href="https://CRAN.R-project.org/package=DT">https://CRAN.R-project.org/package=DT</a>
</div>
<div id="ref-glue" class="csl-entry">
4. Hester, J., &amp; Bryan, J. (2024). <em><span class="nocase">glue</span>: Interpreted string literals</em>. <a href="https://CRAN.R-project.org/package=glue">https://CRAN.R-project.org/package=glue</a>
</div>
<div id="ref-knitr2014" class="csl-entry">
5. Xie, Y. (2014). <span class="nocase">knitr</span>: A comprehensive tool for reproducible research in <span>R</span>. In V. Stodden, F. Leisch, &amp; R. D. Peng (Eds.), <em>Implementing reproducible computational research</em>. Chapman; Hall/CRC.
</div>
<div id="ref-knitr2015" class="csl-entry">
6. Xie, Y. (2015). <em>Dynamic documents with <span>R</span> and knitr</em> (2nd ed.). Chapman; Hall/CRC. <a href="https://yihui.org/knitr/">https://yihui.org/knitr/</a>
</div>
<div id="ref-knitr2025" class="csl-entry">
7. Xie, Y. (2025). <em><span class="nocase">knitr</span>: A general-purpose package for dynamic report generation in <span>R</span></em>. <a href="https://yihui.org/knitr/">https://yihui.org/knitr/</a>
</div>
<div id="ref-qicharts2" class="csl-entry">
8. Anhoej, J. (2024). <em>qicharts2: Quality improvement charts</em>. <a href="https://CRAN.R-project.org/package=qicharts2">https://CRAN.R-project.org/package=qicharts2</a>
</div>
<div id="ref-rmarkdown2018" class="csl-entry">
9. Xie, Y., Allaire, J. J., &amp; Grolemund, G. (2018). <em>R markdown: The definitive guide</em>. Chapman; Hall/CRC. <a href="https://bookdown.org/yihui/rmarkdown">https://bookdown.org/yihui/rmarkdown</a>
</div>
<div id="ref-rmarkdown2020" class="csl-entry">
10. Xie, Y., Dervieux, C., &amp; Riederer, E. (2020). <em>R markdown cookbook</em>. Chapman; Hall/CRC. <a href="https://bookdown.org/yihui/rmarkdown-cookbook">https://bookdown.org/yihui/rmarkdown-cookbook</a>
</div>
<div id="ref-rmarkdown2024" class="csl-entry">
11. Allaire, J., Xie, Y., Dervieux, C., McPherson, J., Luraschi, J., Ushey, K., Atkins, A., Wickham, H., Cheng, J., Chang, W., &amp; Iannone, R. (2024). <em><span class="nocase">rmarkdown</span>: Dynamic documents for r</em>. <a href="https://github.com/rstudio/rmarkdown">https://github.com/rstudio/rmarkdown</a>
</div>
<div id="ref-survival2000" class="csl-entry">
12. Terry M. Therneau, &amp; Patricia M. Grambsch. (2000). <em>Modeling survival data: Extending the <span>C</span>ox model</em>. Springer.
</div>
<div id="ref-survival2024" class="csl-entry">
13. Therneau, T. M. (2024). <em>A package for survival analysis in r</em>. <a href="https://CRAN.R-project.org/package=survival">https://CRAN.R-project.org/package=survival</a>
</div>
<div id="ref-survminer" class="csl-entry">
14. Kassambara, A., Kosinski, M., &amp; Biecek, P. (2024). <em><span class="nocase">survminer</span>: Drawing survival curves using <span>“<span class="nocase">ggplot2</span>”</span></em>. <a href="https://CRAN.R-project.org/package=survminer">https://CRAN.R-project.org/package=survminer</a>
</div>
<div id="ref-tidyverse" class="csl-entry">
15. Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L. D., François, R., Grolemund, G., Hayes, A., Henry, L., Hester, J., Kuhn, M., Pedersen, T. L., Miller, E., Bache, S. M., Müller, K., Ooms, J., Robinson, D., Seidel, D. P., Spinu, V., … Yutani, H. (2019). Welcome to the <span class="nocase">tidyverse</span>. <em>Journal of Open Source Software</em>, <em>4</em>(43), 1686. <a href="https://doi.org/10.21105/joss.01686">https://doi.org/10.21105/joss.01686</a>
</div>
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div>This post is released under CC-BY-4.0 https://creativecommons.org/licenses/by/4.0/. Data shown is sourced from the Lung Dataset in the survminer R package</div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Ⓒ Calum Polwart 2025</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2025,
  author = {Polwart, Calum},
  title = {White {Axes,} Line Labels and Transparency in {Survival}
    {Curves}},
  date = {2025-05-11},
  url = {https://www.chemo.org.uk/posts/TransparentSurvivalCurves.html},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2025" class="csl-entry quarto-appendix-citeas">
1. Polwart, C. (2025, May 11). White Axes, line labels and transparency
in Survival Curves. <em>Chemo.org.uk</em>. <a href="https://www.chemo.org.uk/posts/TransparentSurvivalCurves.html">https://www.chemo.org.uk/posts/TransparentSurvivalCurves.html</a>
</div></div></section></div> ]]></description>
  <category>Data</category>
  <category>R</category>
  <guid>https://www.chemo.org.uk/posts/TransparentSurvivalCurves.html</guid>
  <pubDate>Sat, 10 May 2025 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Interaction checking tools</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/Story-behind-interaction-poster.html</link>
  <description><![CDATA[ 





<p>I’ve just published <a href="https://www.chemo.org.uk/posters/InteractionsPoster.html">a poster</a> and thought I’d share some of the thinking behind it.</p>
<p><img src="https://www.chemo.org.uk/posters/images/InteractionsPoster.png" class="img-fluid"></p>
<section id="where-did-the-idea-come-from" class="level2">
<h2 class="anchored" data-anchor-id="where-did-the-idea-come-from">Where did the idea come from?</h2>
<p>This <a href="https://www.chemo.org.uk/posters/InteractionsPoster.html">poster</a> wasn’t my idea. Perhaps it wasn’t really anyone’s idea but two people were pretty key in developing the idea. Chloë Waterson, then working at County Durham and Darlington NHS Foundation Trust and Rajinder Nijjar, working for Guys’ and St Thomas’ and NHS England were the real instigators. We spoke with a few collaborators along the way but these two have become co-investigators on this project because they both asked a question around the same time.</p>
<p>Chloë was first to drop me a note asking if I’d seen that <a href="https://cancer-druginteractions.org/checker">Liverpool Cancer Drug Interaction</a> checker might be being shut down and what did I think about this. That was nearly 18 months ago. And what did I think? Well my initial though was a mixture of “Oh that’s a shame”, “I’m old enough to remember using a book to look up interactions” and “Sounds like its a money issue, someone will sort it”. I did also briefly ponder why that particular tool had become so popular. We briefly spoke about the idea of being able to check what was a good alternative, but did not much more. I did spend a couple of hours studying how the website actually worked and seeing if the data would be available in an archived form if the site was pulled. Anyway, move on a few weeks and Raj sends an email round some colleagues working for NHS England asking what people are using instead. She’d been using UpToDate but was finding problems. Seemingly new interactions surfacing for drugs we’d used together for years and some drugs not being listed (domperidone was her example).</p>
<p>I joined Raj and Chloë together in a Teams call. We tried inviting others who had shown interest on the <a href="https://www.bopa.org.uk/forums/">BOPA Forum</a> but didn’t get any takers. But we had the start of an idea. We wanted to know what was the best alternative. We were still talking as if Liverpool was the gold standard.</p>
<p>We bounced some ideas around about how we could do that. Creating our own test scenarios. Using specificity and sensitivity to measure things. A little searching, followed by more detailed searching revealed we weren’t the first to tackle the question of how good a drug interaction checking tool is. A little more work and we were uncovering papers describing oncology specific tools.</p>


</section>

<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2024,
  author = {Polwart, Calum},
  title = {Interaction Checking Tools},
  date = {2024-10-11},
  url = {https://www.chemo.org.uk/posts/Story-behind-interaction-poster.html},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2024" class="csl-entry quarto-appendix-citeas">
1. Polwart, C. (2024, October 11). Interaction checking tools.
<em>Chemo.org.uk</em>. <a href="https://www.chemo.org.uk/posts/Story-behind-interaction-poster.html">https://www.chemo.org.uk/posts/Story-behind-interaction-poster.html</a>
</div></div></section></div> ]]></description>
  <guid>https://www.chemo.org.uk/posts/Story-behind-interaction-poster.html</guid>
  <pubDate>Thu, 10 Oct 2024 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Formatting qicharts2</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/Formatting-qicharts2.html</link>
  <description><![CDATA[ 





<section id="brief-background" class="level1">
<h1>Brief background</h1>
<p>I was asked recently about the best visualisation for a quality improvement project. This was a project that had aimed to reduce the <a href="https://doi.org/10.6084/m9.figshare.26963458">frequency of errors detected by a pharmacy team</a>. This was a specific error, and so would be relatively rare. With a common event, you can easily plot something like daily intervention rates and for me I’d usually suggest using the <a href="https://cran.r-project.org/web/packages/NHSRplotthedots/vignettes/intro.html">NHS Plot the Dots</a><span class="citation" data-cites="NHSRplotthedots"><sup>[1]</sup></span> package as it has a lot of ability to customise and is really rather well written. But for rare events a time between events plot (often called a ‘T’ plot) is much better. This is the forgotten cousin in SPC charting, and often omitted from the most common SPC tools. NHSRplotthedots can’t do ‘t’ plots. But an R package called <a href="https://cran.r-project.org/web/packages/qicharts/vignettes/controlcharts.html">qicharts</a> can. qichart appears to have been superseded by <a href="https://cran.r-project.org/web/packages/qicharts2/vignettes/qicharts2.html">qicharts2</a><span class="citation" data-cites="qicharts2"><sup>[2]</sup></span> which produces a ggplot2 object which, I thought at least, would mean we could style the graphics more easily using the ggplot grammar of graphics.</p>
<section id="difference-between-a-standard-spc-and-t-plot" class="level2">
<h2 class="anchored" data-anchor-id="difference-between-a-standard-spc-and-t-plot">Difference between a standard SPC and T plot</h2>
<p>This seems limited in description, but the control lines are calculated in a different way. A moving average is used instead of a mean/median. This means you cant just relabel the existing SPC charts other tools make. There is a rather nice NHS PDF available <a href="https://www.elft.nhs.uk/sites/default/files/import-news/T-Chart-Formula.pdf">here</a> that outlines the manual process to build the data.</p>
<p>A T plot is plotting the time (usually in days) between events happening. If you introduce a new process to reduce errors, you’d hope to see the time between events <strong>increase</strong>. It is as simple as that. The rest of the SPC rules - more than 6 values above the control line a value outside of the 3 sigma bands etc are the same as normal. Although I’ve not seen it written down, I think ‘impossible’ values (less than zero) are also not shown in the sigma ranges. And certainly the tool all check that the time between events isn’t zero. If you have two events on the same day, you need to use a fraction of a day to capture the second event. (If that happened lots you might be better using hours as a measure instead of days).</p>
</section>
<section id="lets-create-a-very-simple-example" class="level2">
<h2 class="anchored" data-anchor-id="lets-create-a-very-simple-example">Lets create a very simple example</h2>
<p>We might as well use the example data provided on that rather nice <a href="https://www.elft.nhs.uk/sites/default/files/import-news/T-Chart-Formula.pdf">NHS PDF</a> document. It looks to be measuring time between falls.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Create an object with the dates of the falls</span></span>
<span id="cb1-2">fallsDates <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb1-3">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-03-02"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-03-06"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-03-07"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-03-15"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-03-22"</span>,</span>
<span id="cb1-4">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-04-01"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-04-11"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-04-14"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-04-26"</span>, </span>
<span id="cb1-5">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-05-03"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-05-13"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-05-28"</span>,</span>
<span id="cb1-6">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-06-04"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-06-10"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-06-14"</span>,  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-06-21"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2014-06-30"</span> ))</span>
<span id="cb1-7"></span>
<span id="cb1-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Calculate the time between events</span></span>
<span id="cb1-9">events <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">diff</span>(fallsDates))</span></code></pre></div>
</details>
</div>
<p>The NHS PDF has one feature I don’t like, it uses dates along the x-axis. I don’t think that’s great practice, as dates on an x-axis should usually be on a time scale and these are actually the specific dates of events. There may be times that’s useful - such as picking out events around holiday periods etc. But usually the x-axis for a t-plot should be a sequential line of event numbers.</p>
<p>In its simplest form qiplots2 will give as a t-chart with just this code:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(qicharts2)</span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">qic</span>(</span>
<span id="cb2-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> events,</span>
<span id="cb2-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(events),</span>
<span id="cb2-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chart =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"t"</span></span>
<span id="cb2-7">)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/Formatting-qicharts2_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>There are <a href="https://anhoej.github.io/qicharts2/reference/qic.html">clearly documented</a> parameters to change titles, axis labels etc. So you can quickly move to a graph like this:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">qic</span>(</span>
<span id="cb3-2">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> events,</span>
<span id="cb3-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(events),</span>
<span id="cb3-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chart =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"t"</span>,</span>
<span id="cb3-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time between falls"</span>,</span>
<span id="cb3-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SPC 't' chart"</span>,</span>
<span id="cb3-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xlab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fall number"</span>,</span>
<span id="cb3-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ylab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time (days)"</span></span>
<span id="cb3-9">)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/Formatting-qicharts2_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>And you can either freeze data or split the data at a certain point if you want to see if an intervention is helping. For the sake of demonstration we will assume some falls reduction intervention was introduced after the 10th fall.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">qic</span>(</span>
<span id="cb4-2">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> events,</span>
<span id="cb4-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(events),</span>
<span id="cb4-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chart =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"t"</span>,</span>
<span id="cb4-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time between falls"</span>,</span>
<span id="cb4-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SPC 't' chart"</span>,</span>
<span id="cb4-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xlab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fall number"</span>,</span>
<span id="cb4-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ylab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time (days)"</span>,</span>
<span id="cb4-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">part =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span></span>
<span id="cb4-10">)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/Formatting-qicharts2_files/figure-html/unnamed-chunk-4-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="formatting-the-result" class="level2">
<h2 class="anchored" data-anchor-id="formatting-the-result">Formatting the result</h2>
<p>This is a ggplot, but it hasn’t been created in a conventional ggplot way. That is you <strong>are not</strong> entering code along the lines of:</p>
<pre><code>data |&gt;
    ggplot2(aes(x = .., y = ..)) +
    geom_qichart()</code></pre>
<p>If you were, your formatting would usually be controlled in the geom. So what can we do?</p>
<p>Well firstly, it is a ggplot object. So you can apply ggplot theme actions. For example:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(ggplot2)</span></code></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Loading required package: ggplot2</code></pre>
</div>
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">qic</span>(</span>
<span id="cb8-2">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> events,</span>
<span id="cb8-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(events),</span>
<span id="cb8-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chart =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"t"</span>,</span>
<span id="cb8-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time between falls"</span>,</span>
<span id="cb8-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SPC 't' chart"</span>,</span>
<span id="cb8-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xlab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fall number"</span>,</span>
<span id="cb8-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ylab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time (days)"</span>,</span>
<span id="cb8-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">part =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span></span>
<span id="cb8-10">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb8-11">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>()</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/Formatting-qicharts2_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Adding the theme, means if the theme has a legend it will appear, but we can turn that off as usual with a ggplot theme legend position none statement. All this means we can edit the plotting canvas, the size of text, the fonts, etc. But the actual data lines and the grey shaded 3 sigma zones (produced with a geom_ribbon are beyond easy reach).</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">qic</span>(</span>
<span id="cb9-2">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> events,</span>
<span id="cb9-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(events),</span>
<span id="cb9-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chart =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"t"</span>,</span>
<span id="cb9-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time between falls"</span>,</span>
<span id="cb9-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SPC 't' chart"</span>,</span>
<span id="cb9-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xlab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fall number"</span>,</span>
<span id="cb9-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ylab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time (days)"</span>,</span>
<span id="cb9-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">part =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span></span>
<span id="cb9-10">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-11">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-12">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span>) , </span>
<span id="cb9-13">             <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/Formatting-qicharts2_files/figure-html/unnamed-chunk-6-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="formatting-the-lines-and-shading" class="level2">
<h2 class="anchored" data-anchor-id="formatting-the-lines-and-shading">Formatting the lines and shading</h2>
<p>I couldn’t see an easy way to change the lines and shading. It might be possible by hacking a grob produced from the plot but frankly that felt like far too much effort. I might as well try and draw the graph from the raw data! This is <a href="https://github.com/anhoej/qicharts2">open source software</a> - which means we can see the code that produces the graph and thats always worth a look in these situations. The key functionfor plotting lies <a href="https://github.com/anhoej/qicharts2/blob/master/R/qic.plot.R">here</a>.</p>
<pre><code>plot.qic &lt;- function(x, title, ylab, xlab, subtitle, caption, part.labels,
                     n.facets,
                     nrow, ncol, scales, show.labels, show.grid, show.95,
                     decimals, flip, dots.only, point.size,
                     x.format, x.angle, x.pad,
                     y.expand, y.percent, y.percent.accuracy, strip.horizontal,
                     # col.line = '#5DA5DA', 
                     # col.signal = '#F15854', 
                     # col.target = '#059748',
                     ...)</code></pre>
<p>Which in its-self is interesting. Because there are three commented out variables in the function which may be a future development.</p>
<pre><code>
  col1      &lt;- '#8C8C8C' # rgb(140, 140, 140, maxColorValue = 255) # grey
  col2      &lt;- getOption('qic.linecol', default = '#5DA5DA')       # blue
  # col3      &lt;- getOption('qic.signalcol', default = '#F15854')     # red
  col3      &lt;- getOption('qic.signalcol', default = '#FAA43A')     # amber
  col4      &lt;- getOption('qic.targetcol', default = '#059748')     # green
  col5      &lt;- '#C8C8C8' # rgb(200, 200, 200, maxColorValue = 255) # light grey
  cols      &lt;- c('col1' = col1,
                 'col2' = col2,
                 'col3' = col3,
                 'col4' = col4,
                 'col5' = col5)</code></pre>
<p>So, actually - the plotting function is looking up its colours from a set of options called qic.[variable] and applying some defaults if these are not set. That means we can set those variables and change the colours.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1">currentOptions <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">options</span>()</span>
<span id="cb12-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">options</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">qic.linecol =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>)</span>
<span id="cb12-3"></span>
<span id="cb12-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">qic</span>(</span>
<span id="cb12-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> events,</span>
<span id="cb12-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(events),</span>
<span id="cb12-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chart =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"t"</span>,</span>
<span id="cb12-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time between falls"</span>,</span>
<span id="cb12-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SPC 't' chart"</span>,</span>
<span id="cb12-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xlab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fall number"</span>,</span>
<span id="cb12-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ylab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time (days)"</span>,</span>
<span id="cb12-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">part =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span></span>
<span id="cb12-13">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb12-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb12-15">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span>) , </span>
<span id="cb12-16">             <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/Formatting-qicharts2_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>That leaves just the ribbon to try and edit.</p>
<pre><code># Add control limits and centre and target lines
  if (getOption('qic.clshade', default = TRUE) &amp;
      sum(!is.na(x$lcl))) {
    p &lt;- p +
      geom_ribbon(aes_(ymin = ~ lcl, ymax = ~ ucl),
                  fill = 'grey87',
                  alpha = 0.4)
  } else {
    p &lt;- p +
      geom_line(aes_(y = ~ lcl), colour = col1, na.rm = T)
    
    p &lt;- p +
      geom_line(aes_(y = ~ ucl), colour = col1, na.rm = T)
  }</code></pre>
<p>So there is a further option, completely undocumented as far as I can see, that switches on / off the shading.</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1">currentOptions <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">options</span>()</span>
<span id="cb14-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">options</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">qic.linecol =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">qic.clshade =</span> F)</span>
<span id="cb14-3"></span>
<span id="cb14-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">qic</span>(</span>
<span id="cb14-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> events,</span>
<span id="cb14-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(events),</span>
<span id="cb14-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chart =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"t"</span>,</span>
<span id="cb14-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time between falls"</span>,</span>
<span id="cb14-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SPC 't' chart"</span>,</span>
<span id="cb14-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xlab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fall number"</span>,</span>
<span id="cb14-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ylab =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Time (days)"</span>,</span>
<span id="cb14-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">part =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span></span>
<span id="cb14-13">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb14-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb14-15">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span>) , </span>
<span id="cb14-16">             <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/Formatting-qicharts2_files/figure-html/unnamed-chunk-8-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>And there we have it. A chart with line colours edited, text adjusted and the shading removed. Why the package authors didn’t do it with geom_qichart I don’t quite know. But if you need a customisable qichart for a time series, I hope these notes help.</p>


</section>
</section>
<section id="bibliography" class="level1 unnumbered">


</section>

<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-NHSRplotthedots" class="csl-entry">
1. Reading, C., Wellesley-Miller, S., Turner, Z., Jemmett, T., Smith, T., Mainey, C., &amp; MacKintosh, J. (2021). <em>NHSRplotthedots: Draw XmR charts for NHSE/i ’making data count’ programme</em>. <a href="https://CRAN.R-project.org/package=NHSRplotthedots">https://CRAN.R-project.org/package=NHSRplotthedots</a>
</div>
<div id="ref-qicharts2" class="csl-entry">
2. Anhoej, J. (2024). <em>qicharts2: Quality improvement charts</em>. <a href="https://CRAN.R-project.org/package=qicharts2">https://CRAN.R-project.org/package=qicharts2</a>
</div>
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2024,
  author = {Polwart, Calum},
  title = {Formatting Qicharts2},
  date = {2024-10-11},
  url = {https://www.chemo.org.uk/posts/Formatting-qicharts2.html},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2024" class="csl-entry quarto-appendix-citeas">
1. Polwart, C. (2024, October 11). Formatting qicharts2.
<em>Chemo.org.uk</em>. <a href="https://www.chemo.org.uk/posts/Formatting-qicharts2.html">https://www.chemo.org.uk/posts/Formatting-qicharts2.html</a>
</div></div></section></div> ]]></description>
  <guid>https://www.chemo.org.uk/posts/Formatting-qicharts2.html</guid>
  <pubDate>Thu, 10 Oct 2024 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Self-assessment of Compliance with British Oncology Pharmacy Association (BOPA) Standards for Clinical Verification of Systemic Anti-Cancer Therapies (SACT)</title>
  <link>https://www.chemo.org.uk/posters/BOPAClinicalPharmacy.html</link>
  <description><![CDATA[ 




<p>This poster was an attempt to measure resources and its relationship to compliance with verification.</p>
<p>The sample size was not enough to make reliable guesses on resource vs capacity. However, there was clearly variation in compliance.</p>
<p><a href="https://doi.org/10.6084/m9.figshare.26962102"><img src="https://www.chemo.org.uk/posters/images/BOPAPoster-ClinicalVerificaton.png" class="img-fluid"></a></p>



<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2024,
  author = {Polwart, Calum and Gabriel, Sumantha},
  title = {Self-Assessment of {Compliance} with {British} {Oncology}
    {Pharmacy} {Association} {(BOPA)} {Standards} for {Clinical}
    {Verification} of {Systemic} {Anti-Cancer} {Therapies} {(SACT)}},
  date = {2024-10-11},
  url = {https://doi.org/10.6084/m9.figshare.26962102},
  doi = {10.6084/m9.figshare.26962102},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2024" class="csl-entry quarto-appendix-citeas">
1. Polwart, C., &amp; Gabriel, S. (2024, October 11).
<em>Self-assessment of Compliance with British Oncology Pharmacy
Association (BOPA) Standards for Clinical Verification of Systemic
Anti-Cancer Therapies (SACT)</em>. <a href="https://doi.org/10.6084/m9.figshare.26962102">https://doi.org/10.6084/m9.figshare.26962102</a>
</div></div></section></div> ]]></description>
  <category>BOPA</category>
  <category>Poster</category>
  <category>Verification</category>
  <guid>https://www.chemo.org.uk/posters/BOPAClinicalPharmacy.html</guid>
  <pubDate>Thu, 10 Oct 2024 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Selection of an optimal drug-drug interaction database for use in oncology and haematology settings</title>
  <link>https://www.chemo.org.uk/posters/InteractionsPoster.html</link>
  <description><![CDATA[ 




<p>This poster started life following the announcement that the Liverpool Cancer Drug Interaction website was closing down. Discussions ensued about good alternatives. We identified 6 alternative candidates and assessed each against <a href="https://cancer-druginteractions.org/">Liverpool,</a> against a previously published paper<span class="citation" data-cites="marcathComparisonNineTools2018"><sup>[1]</sup></span> and an adaption of a method<span class="citation" data-cites="abarca2006"><sup>[2]</sup></span> to combine the results of multiple tools.</p>
<p><a href="https://doi.org/10.6084/m9.figshare.26965504"><img src="https://www.chemo.org.uk/posters/images/InteractionsPoster.png" class="img-fluid"></a></p>




<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-marcathComparisonNineTools2018" class="csl-entry">
1. Marcath, L. A., Xi, J., Hoylman, E. K., Kidwell, K. M., Kraft, S. L., &amp; Hertz, D. L. (2018). Comparison of <span>Nine Tools</span> for <span>Screening Drug-Drug Interactions</span> of <span>Oral Oncolytics</span>. <em>Journal of Oncology Practice</em>, <em>14</em>(6), e368–e374. <a href="https://doi.org/10.1200/JOP.18.00086">https://doi.org/10.1200/JOP.18.00086</a>
</div>
<div id="ref-abarca2006" class="csl-entry">
2. Abarca, J., Colon, L. R., Wang, V. S., Malone, D. C., Murphy, J. E., &amp; Armstrong, E. P. (2006). Evaluation of the performance of drug-drug interaction screening software in community and hospital pharmacies. <em>Journal of managed care pharmacy : JMCP</em>, <em>12</em>(5), 383–389. <a href="https://doi.org/10.18553/jmcp.2006.12.5.383">https://doi.org/10.18553/jmcp.2006.12.5.383</a>
</div>
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2024,
  author = {Polwart, Calum and Waterson, Chloe and Nijjar, Rajinder},
  title = {Selection of an Optimal Drug-Drug Interaction Database for
    Use in Oncology and Haematology Settings},
  date = {2024-10-11},
  url = {https://doi.org/10.6084/m9.figshare.26965504},
  doi = {10.6084/m9.figshare.26965504},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2024" class="csl-entry quarto-appendix-citeas">
1. Polwart, C., Waterson, C., &amp; Nijjar, R. (2024, October 11).
<em>Selection of an optimal drug-drug interaction database for use in
oncology and haematology settings</em>. <a href="https://doi.org/10.6084/m9.figshare.26965504">https://doi.org/10.6084/m9.figshare.26965504</a>
</div></div></section></div> ]]></description>
  <category>BOPA</category>
  <category>Poster</category>
  <category>Prescribing</category>
  <guid>https://www.chemo.org.uk/posters/InteractionsPoster.html</guid>
  <pubDate>Thu, 10 Oct 2024 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Engaging with Social Media</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/Engaging_posters.html</link>
  <description><![CDATA[ 





<p>This has been bugging me for a little while. I was going to do a twitter thread about it. But actually, twitter has been bugging me to. So I thought I might post it to mastodon, but of course no-one will read it there. So I’m going back to the ‘olden days’ and blogging about it. I’m posting it up a few days before <a href="https://www.bopa.org.uk/latest-conference-2024/">#BOPA2024</a> in the hope that it stirs a few thoughts.</p>
<p>If I happen to have picked your social media post or your poster to comment on, please don’t be offended. They were mostly picked at random from posters in my area of work, that I’ve looked at this weekend, to show what people do that could improve. I could have picked 100’s of other examples. And I’m sure people will reply with examples of mine that are worse.</p>
<section id="the-scenario" class="level2">
<h2 class="anchored" data-anchor-id="the-scenario">The scenario</h2>
<p>You’ve done a piece of work, you’ve analysed your data and somehow shrunk your data to 3-500 words to submit as an abstract to your flashy conference. Its been accepted. (Well done - remember most conferences are rejecting a proportion of submissions). You’ve hopefully now produced a beautiful poster and had it nicely printed. Its on display at the conference. Your job is done, right?</p>
</section>
<section id="displaying-your-poster" class="level2">
<h2 class="anchored" data-anchor-id="displaying-your-poster">Displaying your poster</h2>
<p>Surely, all you have to do with your poster is pin it to the poster board, stand near it for your allotted time and be ready to answer some questions, guide people through your poster. After-all, that’s why people come to conferences isn’t it. There is nothing else left for you to do, if no-one engages with you and your poster either it is the audience’s fault for not having enough insight to realise how ground breaking your scientific discovery is, or your science was rubbish and you should never present again. Right?</p>
<p>It doesn’t all stop when you display the poster. In-fact, your work is only just beginning! Firstly, who is your real audience. The 200 people who might walk past the poster at your allotted time? The other delegates who have gone for coffee instead? Or everyone in your profession in the world? (OK that sounds a bit scary - but there is a very high chance there are people who are interested in what you’ve done who aren’t at your conference.)</p>
<p>If you are into social media, you’ll know it is very common to post he proverbial “selfie” with your poster. So well done - you’ve shared your poster with the world… haven’t you?</p>
</section>
<section id="engaging-social-media---is-probably-its-own-science" class="level2">
<h2 class="anchored" data-anchor-id="engaging-social-media---is-probably-its-own-science">Engaging Social Media - is probably its own Science</h2>
<p>Public relations, publicity and whatever you collectively label “influencer” culture as is almost certainly its own science. Major PR departments test different engagement approaches (that’s what they call getting you to spend time thinking about their product) using A <em>versus</em> B analysis in much the same way as “proper” science people might test two drugs against each other to work out what is best. I’m not in any way claiming to be an “influencer” or an expert on Social Media. But there are some things I can tell you are “wrong”. With “wrong” being that they don’t help me to engage with your ‘product’. Your product is your research, your poster and your take home message. I’m hoping by addressing some of what I find hard to engage with, others can learn from other people’s mistakes and improve their own poster engagement.</p>
<section id="does-social-media-really-matter" class="level3">
<h3 class="anchored" data-anchor-id="does-social-media-really-matter">Does Social Media really matter?</h3>
<p>I’ve presented posters at conferences, been put on a poster board at the very far corner and not a single person has spoken to me. That’s pretty de-moralising.</p>
<p>I’ve never posted a poster on social media and not been able to at least see people looked at the poster. And almost always, someone replies, re-tweets/re-posts or likes your poster. If they don’t, it might be that you’ve missed some of the things below that I think affect engagement.</p>
<p>If one person not at the conference engages in a full conversation online about my poster, and no-one bothers to stop and ask questions in person - I still think that was worth displaying the poster.</p>
</section>
<section id="the-selfie" class="level3">
<h3 class="anchored" data-anchor-id="the-selfie">The Selfie</h3>
<p>I’m sure “selfies” are great at facilitating engagement. Your ‘followers’ are scrolling their endless stream of cat pictures and suddenly see a familiar face. They stop. They read that you are at a conference. Great. You’ve got the start of some engagement.</p>
<p></p><div id="tweet-43985"></div><script>tweet={"url":"https:\/\/twitter.com\/Florez_Lab\/status\/1840084984117506250","author_name":"#FlorezLab","author_url":"https:\/\/twitter.com\/Florez_Lab","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EDYK the Florez lab is at \u003Ca href=\"https:\/\/twitter.com\/hashtag\/ASCOQLTY24?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#ASCOQLTY24\u003C\/a\u003E. Come say hi and learn about our research focusing on the experiences of patients in the smoking cessation program at \u003Ca href=\"https:\/\/twitter.com\/DanaFarber?ref_src=twsrc%5Etfw\"\u003E@DanaFarber\u003C\/a\u003E. Thanks to all the hard work our team members and partners have done to help us get here! \u003Ca href=\"https:\/\/t.co\/n3h32ttznz\"\u003Epic.twitter.com\/n3h32ttznz\u003C\/a\u003E\u003C\/p\u003E&mdash; #FlorezLab (@Florez_Lab) \u003Ca href=\"https:\/\/twitter.com\/Florez_Lab\/status\/1840084984117506250?ref_src=twsrc%5Etfw\"\u003ESeptember 28, 2024\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-43985").innerHTML = tweet["html"];</script><p></p>
<p>Indeed that sort of thing is what happens as you browse the poster walls at a conference. People stop to look at posters of people they know. Two things then come to mind here: -</p>
<ol type="1">
<li><p>If your friends are stopping by, you could have sent them a text with your results;</p></li>
<li><p>At least let them look at your poster.</p></li>
</ol>
<p>In the <span class="citation" data-cites="Florez_Lab">@Florez_Lab</span> example above, the presenters are unfortunately in front of the poster. If only they’d stepped aside of the poster like this tweet:</p>
<p></p><div id="tweet-23865"></div><script>tweet={"url":"https:\/\/twitter.com\/coffeemommy\/status\/1839760646419935611","author_name":"Stacey Tinianov (she\/her) MPH, BCPA","author_url":"https:\/\/twitter.com\/coffeemommy","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EIntended to send this earlier when I expected to be standing alone by a poster for 90mins. As it turned out, I spoke nonstop for over 100 mins &amp; am now late to session. Hey \u003Ca href=\"https:\/\/twitter.com\/AdvocateCollab?ref_src=twsrc%5Etfw\"\u003E@AdvocateCollab\u003C\/a\u003E - our research was a HUGE hit at \u003Ca href=\"https:\/\/twitter.com\/hashtag\/ASCOQLTY24?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#ASCOQLTY24\u003C\/a\u003E &amp; we&#39;ve got a few new partners! \uD83C\uDF89 \u003Ca href=\"https:\/\/t.co\/r92maFVDXV\"\u003Epic.twitter.com\/r92maFVDXV\u003C\/a\u003E\u003C\/p\u003E&mdash; Stacey Tinianov (she\/her) MPH, BCPA (@coffeemommy) \u003Ca href=\"https:\/\/twitter.com\/coffeemommy\/status\/1839760646419935611?ref_src=twsrc%5Etfw\"\u003ESeptember 27, 2024\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-23865").innerHTML = tweet["html"];</script><p></p>
<p>Now you may well say “but I cant read the poster” - but you can usually download the image from the social media platform and zoom it (even on a phone). Here is the same image cropped to just the poster:</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/images/ZoomedPoster.png" class="img-fluid figure-img"></p>
<figcaption>Zoomed image from @coffeemommy’s tweet above</figcaption>
</figure>
</div>
<p>That image is just about readable.</p>
<p>While aesthetically, this angled picture is probably far more pleasing to the eye than the harshness of a straight on poster picture, it doesn’t make reading the poster easier:</p>
<p></p><div id="tweet-19592"></div><script>tweet={"url":"https:\/\/twitter.com\/hafaydeefe\/status\/1840057240155500578","author_name":"Haydeé Verduzco","author_url":"https:\/\/twitter.com\/hafaydeefe","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EStop by \u003Ca href=\"https:\/\/twitter.com\/iandresmeraz?ref_src=twsrc%5Etfw\"\u003E@iandresmeraz\u003C\/a\u003E&#39;s poster on implementation of low-dose ICI in Mexico. Almost half of surveyed oncologists\/hematologists are already using low-dose ICI, mainly due to economic reasons. However, concerns about efficacy may preclude wider implementation. \u003Ca href=\"https:\/\/twitter.com\/incmnszmx?ref_src=twsrc%5Etfw\"\u003E@incmnszmx\u003C\/a\u003E \u003Ca href=\"https:\/\/twitter.com\/hashtag\/ASCOQLTY24?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#ASCOQLTY24\u003C\/a\u003E \u003Ca href=\"https:\/\/t.co\/6bxNiAUuRM\"\u003Epic.twitter.com\/6bxNiAUuRM\u003C\/a\u003E\u003C\/p\u003E&mdash; Haydeé Verduzco (@hafaydeefe) \u003Ca href=\"https:\/\/twitter.com\/hafaydeefe\/status\/1840057240155500578?ref_src=twsrc%5Etfw\"\u003ESeptember 28, 2024\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-19592").innerHTML = tweet["html"];</script><p></p>
<p>No-one says you can only post one image. Here is a good example of the aesthetically pleasing and the poster for the interested reader</p>
<p></p><div id="tweet-23521"></div><script>tweet={"error":"Sorry, you are not authorized to see this status.","request":"\/oembed?url=https:\/\/twitter.com\/tomiwaawobayiku\/status\/1840060795411149281&align=center"};document.getElementById("tweet-23521").innerHTML = tweet["html"];</script><p></p>
<p>Since the purpose of my blog is to highlight things that could improve. Shiny posters, reflecting light are hard to read. So if you are on the ball - export a copy of the poster as a “.png” file to your phone from your ‘desktop publishing’ software (OK you all use powerpoint - but it can do it too!). Then when you are tweeting why not simply use that picture with your selfie?</p>
</section>
<section id="the-key-message" class="level3">
<h3 class="anchored" data-anchor-id="the-key-message">The key message</h3>
<p>If you’ve ever followed any of <a href="https://x.com/mikemorrison">Mike Morrison</a>’s <a href="https://www.vyond.com/showcase/video/educational-video-mike-morrison-how-to-create-better-research-poster/?utm_medium=cpc&amp;utm_source=google&amp;utm_campaign=PerformanceMaxTier1&amp;utm_content=headline&amp;utm_term=&amp;gad_source=1&amp;gclid=CjwKCAjw9eO3BhBNEiwAoc0-jVO9mxI7EEtbjfCOBgk1ZMlNCS-URRSGA0HIff8Yc39ys-FVs6T4cBoC2BUQAvD_BwE">better poster videos</a>, you’ll probably know he is a massive fan of a single take away sentence describing the findings. In <span class="citation" data-cites="coffeemommy">@coffeemommy</span>’s tweet above it appears at the top of the third column of text. I’m not sure I know what the words mean - but I cant see that she anywhere tweeted the words:</p>
<blockquote class="blockquote">
<p>“Patients, care partners, and community members have contextual knowledge which is not only relevant to the design and development of processes, products and services, but also, through the process of co-creation, these individuals tend to become further involved, motivated, and influenced by the very element they are co-creating.”</p>
</blockquote>
<p>Search engines can’t search words on poster pictures (at least, not in a robust and reliable way). So if I search for “co-creation” and “patients” the picture won’t show up.</p>
<p>If <span class="citation" data-cites="coffeemommy">@coffeemommy</span> had replied to her selfie with the summary text she would have made her post more searchable and her message more engaging. That said, as she says - she seems to have been kept busy at the poster show so maybe she didn’t need more engagement. However, planned in advance, while writing the poster, she might have spotted the key message was actually quite wordy (too long for a standard 280 character tweet).</p>
<p>The angled tweet from <span class="citation" data-cites="hafaydeefe">@hafaydeefe</span> above does this very nicely - Two sentences tell me what the poster is about.</p>
<p>The other thing worth considering is ALT text. Introduced as an alternative to showing the picture in circumstances where the picture isn’t rendered - for instance a very slow internet connection, or someone using a screen reader who has visual impairment. ALT text will make the picture far more searchable.</p>
</section>
<section id="the-posters" class="level3">
<h3 class="anchored" data-anchor-id="the-posters">The Posters</h3>
<p>I set out to blog about how people use Social Media to engage their posters, not to talk poster design. But, I will re-iterate my desire for people to watch Mike Morrison’s original video. And this is important - watch the video. Learn from the video. Using (abusing) his template, without watching the video may be a worse sin in poster publishing than sticking to the age old scientific poster in three columns format.</p>
<p><a href="https://www.hurleywrite.com/blog/writing-skills/the-value-of-white-space/">White space is crucial to readability</a></p>
<p><a href="https://theadminbar.com/accessibility-weekly/text-alignment-left-center-justified/">Justification of text is dreadful for readability</a></p>
<p>Here are some decent attempts to deliver some of what Mike talks about:</p>
<p></p><div id="tweet-88981"></div><script>tweet={"error":"Sorry, you are not authorized to see this status.","request":"\/oembed?url=https:\/\/twitter.com\/lwbpharmd\/status\/1840077394331480552&align=center"};document.getElementById("tweet-88981").innerHTML = tweet["html"];</script><p></p>
<p>We will ignore the fact they are comiting the ‘stand in front of my poster’ sin! I haven’t tried to read their key messages, I suspect they are still too wordy.</p>
<p><span class="citation" data-cites="JorgeOct_">@JorgeOct_</span> has got the selfie thing almost right - only just obstructing his poster. But please <span class="citation" data-cites="JorgeOct_">@JorgeOct_</span> - go and re-listen to Mike’s thoughts on white space, margins, text justification etc. I’m not sure if Mike actually mentions it - but underline is another graphics design sin that reduced readability.</p>
<p></p><div id="tweet-54424"></div><script>tweet={"url":"https:\/\/twitter.com\/JorgeOct_\/status\/1840046773718659510","author_name":"Jorge O. Sanchez O.","author_url":"https:\/\/twitter.com\/JorgeOct_","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EVery happy to present our abstracts as posters in the ASCO Quality Care Symposium this year! Highlighting lung cancer screening awareness, lung cancer after H&amp;N cancer and utilization of palliative care resources in liver cancer. \u003Ca href=\"https:\/\/twitter.com\/hashtag\/ASCO?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#ASCO\u003C\/a\u003E \u003Ca href=\"https:\/\/twitter.com\/hashtag\/ASCOQLTY24?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#ASCOQLTY24\u003C\/a\u003E \u003Ca href=\"https:\/\/twitter.com\/hashtag\/Cancer?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#Cancer\u003C\/a\u003E \u003Ca href=\"https:\/\/twitter.com\/hashtag\/Oncology?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#Oncology\u003C\/a\u003E \u003Ca href=\"https:\/\/t.co\/ogErJMSAy8\"\u003Epic.twitter.com\/ogErJMSAy8\u003C\/a\u003E\u003C\/p\u003E&mdash; Jorge O. Sanchez O. (@JorgeOct_) \u003Ca href=\"https:\/\/twitter.com\/JorgeOct_\/status\/1840046773718659510?ref_src=twsrc%5Etfw\"\u003ESeptember 28, 2024\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-54424").innerHTML = tweet["html"];</script><p></p>
<p>In case you’ve not seen Mike’slatest work - you might want to check out his latest video:</p>
<p></p><div id="youtube-frame" style="position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0;"><iframe width="100%" height="" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/9RnQjmihuR0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div><p></p>
<p>He is less an advocate of the bill board and more an advocate of changing the rules these days.</p>
</section>
<section id="the-qr-code" class="level3">
<h3 class="anchored" data-anchor-id="the-qr-code">The QR Code</h3>
<p>While Mike wasn’t the first person to use a QR code on a poster, they do seem more popular since he promoted it. Mike’s suggestion was that the QR code would actually lead to a whole paper about the poster. I don’t think I’ve ever seen it done.</p>
<p>I like a QR code. At the conference it is absolutely the easiest way to access a ‘hard’ copy of the poster. On Social Media… it is frustrating to say the least - just tag a link in the post!</p>
<p></p><div id="tweet-18757"></div><script>tweet={"url":"https:\/\/twitter.com\/Gina_92_\/status\/1839616220783341904","author_name":"Gina Madera","author_url":"https:\/\/twitter.com\/Gina_92_","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EAlso via the QR code on our poster- come and have a peep \uD83D\uDC40 It’s number 18 and we’ve got some leaflets to take back for your colleagues! \uD83E\uDE75 \u003Ca href=\"https:\/\/twitter.com\/hashtag\/UKAOS24?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#UKAOS24\u003C\/a\u003E \u003Ca href=\"https:\/\/t.co\/tIdAmQwpMw\"\u003Epic.twitter.com\/tIdAmQwpMw\u003C\/a\u003E\u003C\/p\u003E&mdash; Gina Madera (@Gina_92_) \u003Ca href=\"https:\/\/twitter.com\/Gina_92_\/status\/1839616220783341904?ref_src=twsrc%5Etfw\"\u003ESeptember 27, 2024\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-18757").innerHTML = tweet["html"];</script><p></p>
<p>Depending how you create your QR code, or where you link it to (<a href="https://figshare.com/">fig.share</a> is my favourite, <a href="https://www.researchgate.net/">ResearchGate</a> is also good) - you can see how often people engage with your poster. You’ll find people interacting months and years later sometimes. I find people locate things on Research Gate more than they maybe do on fig.share. But I post the poster to fig.share as it lets me embargo it and get a DOI for it. I then link the DOI on ResearchGate after the conference.</p>
</section>
<section id="the-hashtag" class="level3">
<h3 class="anchored" data-anchor-id="the-hashtag">The Hashtag</h3>
<p>Most conferences will have a #hashtag. It goes without saying that your social media post needs to tag that hash tag to be found by interested people. And make sure you get the right hashtag. I don’t think there is a year goes by without me tagging #BOPA23 instead of #BOPA2023 etc.</p>
</section>
<section id="tagging-others" class="level3">
<h3 class="anchored" data-anchor-id="tagging-others">Tagging others</h3>
<p>If you tag other people they usually get notified about your post. That’s a bit like stopping them as they walk past your poster. But there is a good chance they may re-post your post. If you only have 3 followers on twitter, this may well help your work get more noticed. If you are keen to build your social media following, then that probably increases the chances of you picking up some new follows too.</p>
<p>Don’t make your post a hashtag and twitter tag spam. If need be post them as replies. Keep the messages readable.</p>
</section>
<section id="a-bit-shy" class="level3">
<h3 class="anchored" data-anchor-id="a-bit-shy">A bit shy?</h3>
<p>I’m British. I’m not sure Social Media quite works for the traditional British introverted sciencey person. We don’t always like to shout about what we’ve done. But you did a thing, and got it accepted by your peers at a conference. You <strong>should</strong> be proud. But, if you aren’t sure - why not use someone else to promote your work. Just say to them “Hey, I’m not sure I get all this ‘post a selfie’ thing with my poster but I know it helps engagement. I don’t suppose you’d post it to look less contrived”. I’ve done that before with people and it works well in my opinion. In fact, once you realise it might be a thing - you see it happen far more than the selfies:</p>
<p></p><div id="tweet-67041"></div><script>tweet={"url":"https:\/\/twitter.com\/jennyknapton0\/status\/1839786320887193972","author_name":"Jenny Knapton","author_url":"https:\/\/twitter.com\/jennyknapton0","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EA great day at the \u003Ca href=\"https:\/\/twitter.com\/hashtag\/UKAOS24?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#UKAOS24\u003C\/a\u003E conference in Birmingham with my wonderful colleagues, representing \u003Ca href=\"https:\/\/twitter.com\/FrimleyHealth?ref_src=twsrc%5Etfw\"\u003E@FrimleyHealth\u003C\/a\u003E Acute Oncology Service \u003Ca href=\"https:\/\/twitter.com\/UKAOSociety?ref_src=twsrc%5Etfw\"\u003E@UKAOSociety\u003C\/a\u003E \uD83D\uDC99 \u003Ca href=\"https:\/\/t.co\/2L3BxLvuj9\"\u003Epic.twitter.com\/2L3BxLvuj9\u003C\/a\u003E\u003C\/p\u003E&mdash; Jenny Knapton (@jennyknapton0) \u003Ca href=\"https:\/\/twitter.com\/jennyknapton0\/status\/1839786320887193972?ref_src=twsrc%5Etfw\"\u003ESeptember 27, 2024\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-67041").innerHTML = tweet["html"];</script><p></p>
</section>
<section id="tell-a-story" class="level3">
<h3 class="anchored" data-anchor-id="tell-a-story">Tell a story</h3>
<p>I tried this last year, and I think it worked well. Its my general approach to presenting anyway, to try and explain the story rather than just present some data.</p>
<p>Oh and when I said “a bit shy” - <span class="citation" data-cites="chloewaterson88">@chloewaterson88</span> didn’t seem that shy with this quote tweet of the thread…</p>
<p></p><div id="tweet-42132"></div><script>tweet={"url":"https:\/\/twitter.com\/chloewaterson88\/status\/1710352150637793668","author_name":"Chloë Waterson","author_url":"https:\/\/twitter.com\/chloewaterson88","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EThis is me! I won’t repeat everything \u003Ca href=\"https:\/\/twitter.com\/ShinyBlackShoe?ref_src=twsrc%5Etfw\"\u003E@ShinyBlackShoe\u003C\/a\u003E said, he’s much better at twitter than I am! \u003Ca href=\"https:\/\/twitter.com\/hashtag\/BOPA2023?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#BOPA2023\u003C\/a\u003E \u003Ca href=\"https:\/\/t.co\/KRxGVfdK7Q\"\u003Ehttps:\/\/t.co\/KRxGVfdK7Q\u003C\/a\u003E\u003C\/p\u003E&mdash; Chloë Waterson (@chloewaterson88) \u003Ca href=\"https:\/\/twitter.com\/chloewaterson88\/status\/1710352150637793668?ref_src=twsrc%5Etfw\"\u003EOctober 6, 2023\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-42132").innerHTML = tweet["html"];</script><p></p>
<p>Because we were telling a story about HOW we did the analysis as well as why and the results we were able to tag a few people outside of the particular conference sphere we were attending.</p>
</section>
<section id="the-platform" class="level3">
<h3 class="anchored" data-anchor-id="the-platform">The platform</h3>
<p>So far, I’ve been talking about twitter. Twitter (I refuse to be an X user!) thinks of its self as a town square. A place where people can openly sharing information. Prior to recent developments it was pretty decent for that. It still is. But you may well have objections about its owner, its politics, its values etc. There are other platforms. I do post some stuff to mastondon - although I have seen far far less engagement and a bit like taking a poster to a conference and no-one talking to you - posting and no engagement is a bit disheartening.</p>
<p>If you don’t want to be on twitter - work out where else is worth you sharing stuff. But remember - someone had to do it first on twitter for it to become a thing. So perhaps you need to be the first and tell others about it?</p>
</section>
<section id="prepare-in-advance" class="level3">
<h3 class="anchored" data-anchor-id="prepare-in-advance">Prepare in advance</h3>
<p>You will be busy at the conference. Do you actually have time to be writing out tweets about your poster and adding ALT text and finding people to tag in. You already know your message. You already have a copy of your poster. Why not key it up to post (twitter lets you schedule posts, as do various other free platforms that link to twitter). Then you can concentrate on the replies.</p>
<p>This always catches me off guard - I will go into my phone an hour after it posted and see 15 notifications having forgotten I’d pre-set it to post at a certain time.</p>
</section>
</section>
<section id="thats-all-folks" class="level2">
<h2 class="anchored" data-anchor-id="thats-all-folks">That’s all folks…</h2>
<p>Anyway, I hope this is helpful. I hope to see LOTS of social media engagement at #BOPA24 in 12 days time. There are 135 posters. There is less than 2 hours when poster presenters are to be present with their poster - so less than 1 minute per poster. So don’t be surprised if you need to do something to get people to notice <strong>your</strong> poster.</p>


</section>

<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2024,
  author = {Polwart, Calum},
  title = {Engaging with {Social} {Media}},
  date = {2024-09-29},
  url = {https://www.chemo.org.uk/posts/Engaging_posters.html},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2024" class="csl-entry quarto-appendix-citeas">
1. Polwart, C. (2024, September 29). Engaging with Social Media.
<em>Chemo.org.uk</em>. <a href="https://www.chemo.org.uk/posts/Engaging_posters.html">https://www.chemo.org.uk/posts/Engaging_posters.html</a>
</div></div></section></div> ]]></description>
  <guid>https://www.chemo.org.uk/posts/Engaging_posters.html</guid>
  <pubDate>Sat, 28 Sep 2024 23:00:00 GMT</pubDate>
</item>
<item>
  <title>More High Dose Dexamethasone?</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone.html</link>
  <description><![CDATA[ 





<p>Just before the world stopped for the COVID-19 pandemic, I wrote <a href="https://www.thedatalab.org/blog/67/high-dose-dexamethasone/">a blog post</a> on TheDataLab’s website about High Dose Dexamethasone. I was worried that 40mg Dexamethasone seemed to be being dispensed in Primary Care. This is a <strong>huge</strong> dose and would normally only have use in Haemato-oncology as part of a handful of specialist cancer treatments. In fact, even in secondary care, I would be worried that the risk of dispensing error was too high to justify keeping this in stock.</p>
<p>Distracted by the pandemic I kept an eye on prescribing rates and noticed they were descending. Only last year I discovered Dexamethasone 40mg Tablets had been discontinued. We still don’t know if these dispensing events we saw were real or were data anomalies. I suggested to Chloë Waterson that she might want to take a look at the data when she was looking to learn <a href="https://www.r-project.org/">R</a>; whereby she told me it was no more! She had a look at some <a href="posters/Primary Care Prescribing.html">even scarier stuff</a> instead!<span class="citation" data-cites="waterson2023"><sup>[1]</sup></span></p>
<p>So here is a very brief look at what happened, complete with code for those who like a simple R project</p>
<section id="get-the-data-from-open-prescribing" class="level2">
<h2 class="anchored" data-anchor-id="get-the-data-from-open-prescribing">Get the Data from Open Prescribing</h2>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(tidyverse, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">warn.conflicts =</span> F)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(httr, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">warn.conflicts =</span> F)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(jsonlite, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">warn.conflicts =</span> F)</span>
<span id="cb1-4">DexId <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"0603020G0AACJCJ"</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># This is the product code for 40mg Dex on Open Rx</span></span>
<span id="cb1-5"></span>
<span id="cb1-6">url <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> glue<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glue</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"https://openprescribing.net/api/1.0/spending/?code={DexId}&amp;format=json"</span>)</span>
<span id="cb1-7">response <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">GET</span>(url)</span>
<span id="cb1-8"></span>
<span id="cb1-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># translate the API response into a datatable</span></span>
<span id="cb1-10">data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fromJSON</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rawToChar</span>(response<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>content))</span>
<span id="cb1-11"></span>
<span id="cb1-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># translate dates as dates not text</span></span>
<span id="cb1-13">data <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">date =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(date)) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> data</span>
<span id="cb1-15"></span>
<span id="cb1-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># show the data</span></span>
<span id="cb1-17">DT<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">datatable</span>(data)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-0a02a7dd6d0f3d8341c1" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-0a02a7dd6d0f3d8341c1">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],[9,6,8,10,1,6,6,1,4,2,1,1,2,1,1,2,1],[56,23,40,42,2,22,28,2,128,37,30,4,9,4,5,14,4],[1041.93,427.76,743.49,781.11,37.29,409.65,521.26,37.34,2380.09,687.91,557.38,74.40000000000001,167.32,74.51000000000001,93.25,261.02,74.61],["2019-07-01","2019-08-01","2019-09-01","2019-10-01","2019-11-01","2019-12-01","2020-01-01","2020-02-01","2020-04-01","2020-05-01","2020-06-01","2020-09-01","2020-10-01","2020-12-01","2021-04-01","2021-05-01","2021-06-01"],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],["england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england"]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>items<\/th>\n      <th>quantity<\/th>\n      <th>actual_cost<\/th>\n      <th>date<\/th>\n      <th>row_id<\/th>\n      <th>row_name<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[1,2,3]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"items","targets":1},{"name":"quantity","targets":2},{"name":"actual_cost","targets":3},{"name":"date","targets":4},{"name":"row_id","targets":5},{"name":"row_name","targets":6}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
<section id="graph-the-data" class="level2">
<h2 class="anchored" data-anchor-id="graph-the-data">Graph the Data</h2>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(ggplot2)</span>
<span id="cb2-2">data <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-3">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>quantity, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>date)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-4">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># creates a basic column graph</span></span>
<span id="cb2-5">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># cleaner theme</span></span>
<span id="cb2-6">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggtitle</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Number of 40mg Dexamethasone tablets dispensed each month"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-7">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expand_limits</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2024-07-01"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># stretch the x axis to show all the missing right hand data points</span></span>
<span id="cb2-8">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>(   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># label when the original blog happened</span></span>
<span id="cb2-9">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'text'</span>,</span>
<span id="cb2-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2019-08-15"</span>),</span>
<span id="cb2-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">75</span>,</span>
<span id="cb2-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Blog</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">Published'</span>,</span>
<span id="cb2-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fontface =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'bold'</span>, </span>
<span id="cb2-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.5</span>,</span>
<span id="cb2-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">angle =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb2-16">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>(</span>
<span id="cb2-18">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'curve'</span>,</span>
<span id="cb2-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2019-11-15"</span>),</span>
<span id="cb2-20">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>,</span>
<span id="cb2-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">yend =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">28</span>,</span>
<span id="cb2-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xend =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2019-11-15"</span>),</span>
<span id="cb2-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="cb2-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">curvature =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="cb2-25">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">arrow =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrow</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">length =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'cm'</span>))</span>
<span id="cb2-26">  ) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> g1</span>
<span id="cb2-27"></span>
<span id="cb2-28"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(g1)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>We can repeat the process for the number of prescriptions dispensed instead of the number of tablets dispensed. And we can combine those using cowplot.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">data <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb3-2">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>items, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>date)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb3-3">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># creates a basic column graph</span></span>
<span id="cb3-4">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># cleaner theme</span></span>
<span id="cb3-5">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggtitle</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Number of 40mg Dexamethasone prescriptions dispensed each month"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb3-6">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expand_limits</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2024-07-01"</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># stretch the x axis to show all the missing right hand data points</span></span>
<span id="cb3-7">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>(   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># label when the original blog happened</span></span>
<span id="cb3-8">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'text'</span>,</span>
<span id="cb3-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2019-08-15"</span>),</span>
<span id="cb3-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>,</span>
<span id="cb3-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Blog</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">Published'</span>,</span>
<span id="cb3-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fontface =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'bold'</span>, </span>
<span id="cb3-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.5</span>,</span>
<span id="cb3-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">angle =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb3-15">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb3-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotate</span>(</span>
<span id="cb3-17">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'curve'</span>,</span>
<span id="cb3-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2019-11-15"</span>),</span>
<span id="cb3-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span>,</span>
<span id="cb3-20">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">yend =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6.5</span>,</span>
<span id="cb3-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xend =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2019-11-15"</span>),</span>
<span id="cb3-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="cb3-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">curvature =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="cb3-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">arrow =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrow</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">length =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'cm'</span>))</span>
<span id="cb3-25">  ) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> g2</span>
<span id="cb3-26"></span>
<span id="cb3-27"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(g2)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(cowplot)</span>
<span id="cb4-2"></span>
<span id="cb4-3">cowplot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot_grid</span>(g1, g2, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ncol =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone_files/figure-html/unnamed-chunk-4-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>So it definitely looks like I can stop worrying about 40mg Dexamethasone Tablets. But that, instantly made me wonder what happened to the other products I’d been a bit worried by - the 10mg capsule. Well it seems when the 40mg tablet was discontinued a 10mg and 20mg tablet that were launched at the same time!<sup>1</sup></p>
</section>
<section id="other-tablet-strengths" class="level2">
<h2 class="anchored" data-anchor-id="other-tablet-strengths">Other Tablet Strengths</h2>
<p>A browse through the <a href="https://openprescribing.net/dmd/vmp">dm+d directory</a> finds these possible suspects:</p>
<table class="caption-top table">
<caption>“Higher” Strength Dexamethasone Tablets</caption>
<thead>
<tr class="header">
<th>Description</th>
<th>BNF Code</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Dexamethasone 10mg capsules</td>
<td>0603020G0AABYBY</td>
</tr>
<tr class="even">
<td>Dexamethasone 10mg soluble tablets sugar free</td>
<td>0603020G0AACLCL</td>
</tr>
<tr class="odd">
<td>Dexamethasone 20mg soluble tablets sugar free</td>
<td>0603020G0AACMCM</td>
</tr>
</tbody>
</table>
<p>These products do still appear to be available, based on the dm+d directory at least. If we re-run the data download for each of these codes we can create a combined graph. If there was a genuine clinical use for the 40mg tablets, we might expect to see an increase in 20mg dispensing when the 40mg becomes unavailable.</p>
<section id="get-the-data" class="level3">
<h3 class="anchored" data-anchor-id="get-the-data">Get the data</h3>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Add a strength column to the original data</span></span>
<span id="cb5-2">data <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-3">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">strength =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"40mg"</span>) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> data</span>
<span id="cb5-4"></span>
<span id="cb5-5">ids <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"10mg"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"0603020G0AABYBY"</span>,</span>
<span id="cb5-6">        <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"10mg"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"0603020G0AACLCL"</span>, </span>
<span id="cb5-7">        <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"20mg"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"0603020G0AACMCM"</span>)</span>
<span id="cb5-8"></span>
<span id="cb5-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># use a loop to repeat the download for each id</span></span>
<span id="cb5-10"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> ( DexId <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> ids ) {</span>
<span id="cb5-11"></span>
<span id="cb5-12">    url <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> glue<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glue</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"https://openprescribing.net/api/1.0/spending/?code={DexId}&amp;format=json"</span>)</span>
<span id="cb5-13">    response <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">GET</span>(url)</span>
<span id="cb5-14">    newdata <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fromJSON</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rawToChar</span>(response<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>content))</span>
<span id="cb5-15">    newdata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-16">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">date =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(date)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-17">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">strength =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">names</span>(ids[ids <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> DexId]))<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> newdata</span>
<span id="cb5-18">    </span>
<span id="cb5-19">    data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rbind</span>(data, newdata)</span>
<span id="cb5-20">}</span>
<span id="cb5-21"></span>
<span id="cb5-22"></span>
<span id="cb5-23">url <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> glue<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glue</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"https://openprescribing.net/api/1.0/spending/?code={DexId}&amp;format=json"</span>)</span>
<span id="cb5-24">response <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">GET</span>(url)</span>
<span id="cb5-25"></span>
<span id="cb5-26"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># translate the API response into a datatable</span></span>
<span id="cb5-27">newdata <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fromJSON</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rawToChar</span>(response<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>content))</span>
<span id="cb5-28"></span>
<span id="cb5-29"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># translate dates as dates not text</span></span>
<span id="cb5-30">newdata <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-31">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">date =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(date)) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-&gt;</span> newdata</span>
<span id="cb5-32"></span>
<span id="cb5-33"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># show the data</span></span>
<span id="cb5-34">DT<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">datatable</span>(data)</span></code></pre></div>
</details>
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-d38088f9e1ea5136e55f" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-d38088f9e1ea5136e55f">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76"],[9,6,8,10,1,6,6,1,4,2,1,1,2,1,1,2,1,1,1,2,2,7,17,14,9,7,29,17,25,18,21,31,18,16,15,9,8,7,17,15,24,21,19,24,29,33,14,3,1,2,3,5,3,2,5,4,3,3,2,6,7,3,1,2,9,3,3,7,2,8,7,7,7,8,11,5],[56,23,40,42,2,22,28,2,128,37,30,4,9,4,5,14,4,8,3,44,3,45,111,87,41,304,142,118,185,239,157,331,171,156,114,179,83,16,96,116,103,115,230,169,322,187,303,36,10,18,14,80,28,14,188,12,24,34,60,99,36,27,10,5,90,60,16,39,28,101,120,62,71,158,86,34],[1041.93,427.76,743.49,781.11,37.29,409.65,521.26,37.34,2380.09,687.91,557.38,74.40000000000001,167.32,74.51000000000001,93.25,261.02,74.61,10.51,2.92,41.27,3.03,48.35,144.96,96.66,51.94,291.15,179.87,133.56,225.47,278.63,205.92,411.59,201.67,183.3,125.65,171.52,98.95,18.01,105.9,150.1,125.84,110.39,218.36,161.46,308.43,179.56,288.8,67.64,18.72,33.81,28.12,150.14,68.31,34.2,358.14,30.76,60.83,82.69,128.31,217.02,85.63,70.17,26.81,12.03,204.2,136.2,33.19,75.93000000000001,75,251.66,226.49,117.44,134,298.03,164.41,65.05],["2019-07-01","2019-08-01","2019-09-01","2019-10-01","2019-11-01","2019-12-01","2020-01-01","2020-02-01","2020-04-01","2020-05-01","2020-06-01","2020-09-01","2020-10-01","2020-12-01","2021-04-01","2021-05-01","2021-06-01","2022-11-01","2022-02-01","2022-03-01","2022-04-01","2022-05-01","2022-06-01","2022-07-01","2022-08-01","2022-09-01","2022-10-01","2022-11-01","2022-12-01","2023-01-01","2023-02-01","2023-03-01","2023-04-01","2023-05-01","2023-06-01","2023-07-01","2023-08-01","2023-09-01","2023-10-01","2023-11-01","2023-12-01","2024-01-01","2024-02-01","2024-03-01","2024-04-01","2024-05-01","2024-06-01","2022-02-01","2022-03-01","2022-04-01","2022-05-01","2022-06-01","2022-07-01","2022-08-01","2022-09-01","2022-10-01","2022-11-01","2022-12-01","2023-01-01","2023-02-01","2023-03-01","2023-04-01","2023-05-01","2023-06-01","2023-07-01","2023-08-01","2023-09-01","2023-10-01","2023-11-01","2023-12-01","2024-01-01","2024-02-01","2024-03-01","2024-04-01","2024-05-01","2024-06-01"],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],["england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england","england"],["40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","40mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","10mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg","20mg"]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>items<\/th>\n      <th>quantity<\/th>\n      <th>actual_cost<\/th>\n      <th>date<\/th>\n      <th>row_id<\/th>\n      <th>row_name<\/th>\n      <th>strength<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[1,2,3]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"items","targets":1},{"name":"quantity","targets":2},{"name":"actual_cost","targets":3},{"name":"date","targets":4},{"name":"row_id","targets":5},{"name":"row_name","targets":6},{"name":"strength","targets":7}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<p>It looks like we do have some higher strength dispensing happening in 2024!</p>
</section>
</section>
<section id="graph-the-new-data" class="level2">
<h2 class="anchored" data-anchor-id="graph-the-new-data">Graph the new data</h2>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone_files/figure-html/unnamed-chunk-6-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>That’s certainly not a reassuring picture! While the majority of the use is 10mg, even 10mg is a relatively high dose for prescribing in primary care. The equivalent prednisolone dose for 10mg of dexamethasone is over 65mg.</p>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>This graph is more curious. When 40mg tablets were being dispensed (up to the end of 2022), there was a median of 2 prescriptions per month for 22 tablets per month. Between July-19 and June-21, 18 grams of dexamethasone was dispensed. If the 10mg and 20mg tablets directly replaced these, then a similar number of grams should be being dispensed in a similar time span. In fact, since the introduction of 20mg tablets, a median of 7 prescriptions per month and 83 tablets per month have been dispensed.</p>
<p>In the time period July-22 to June-24, 70.47 grams of dexamethasone were dispensed, representing a 4 fold increase in the use of higher strength steroid tablets.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>The discontinuation of 40mg Dexamethasone Tablets resulted in a brief period without dispensing of any high strength dexamethasone prescriptions. While high doses may still have been dispensed using lower strength tablets, the potential to identify these as possibly erroneous is increased by the dispensing of large tablet counts to achieve high doses. However, following the introduction of 10 and 20mg tablets there now seems to be a 4 fold increase in the dispensing of high doses of steroids using higher strength tablets. <strong>I am not reassured!</strong></p>


</section>
<section id="bibliography" class="level1 unnumbered">


</section>


<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-waterson2023" class="csl-entry">
1. Waterson, C., &amp; Polwart, C. (2023). Prescribing of <span>Systemic</span> <span>Anti-Cancer</span> <span>Therapies</span> <span>(SACT)</span> Through <span>Primary</span> <span>Care</span> in <span>England</span>. <em>Journal of Oncology Pharmacy Practice</em>, <em>30</em>(1_suppl). <a href="https://doi.org/10.1177/10781552241228011">https://doi.org/10.1177/10781552241228011</a>
</div>
</div></section><section id="footnotes" class="footnotes footnotes-end-of-document"><h2 class="anchored quarto-appendix-heading">Footnotes</h2>

<ol>
<li id="fn1"><p>There were also 4mg and 8mg tablets launched back when the 40mg tablet was launched. While they still have risks of dispensing errors, the consequential risks is lower and 4 and 8mg are doses that would be commonly prescribed in primary care.↩︎</p></li>
</ol>
</section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div>This post is released under CC-BY-4.0 https://creativecommons.org/licenses/by/4.0/. Data shown is sourced from Open Prescribing, who obtain it from NHS BSA under an Open Government License.</div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Ⓒ Calum Polwart 2024, Crown Copyright.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2024,
  author = {Polwart, Calum},
  title = {More {High} {Dose} {Dexamethasone?}},
  date = {2024-08-25},
  url = {https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone.html},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2024" class="csl-entry quarto-appendix-citeas">
1. Polwart, C. (2024, August 25). More High Dose Dexamethasone?
<em>Chemo.org.uk</em>. <a href="https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone.html">https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone.html</a>
</div></div></section></div> ]]></description>
  <category>OpenPrescribing</category>
  <category>Data</category>
  <category>Dexamethasone</category>
  <guid>https://www.chemo.org.uk/posts/MoreHigh-Dose-Dexamethasone.html</guid>
  <pubDate>Sat, 24 Aug 2024 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Strange citations?</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/StrangeCitations.html</link>
  <description><![CDATA[ 





<p>I’m not particularly well published despite what some people seem to think. As a result I have Google Scholar set up to tell me if someone cites anything I’ve published. Yes, that might be a little “sad”, but I think its sort of helpful to know if anyone finds anything your write useful!</p>
<p>Back in 2022, I <a href="articles/RWO-GI.html">published a paper</a> with two of my colleagues<span class="citation" data-cites="wadd2022"><sup>[1]</sup></span>. It describes the real world outcomes of some anticancer drugs. Its an OK paper. Its been cited a couple of times by people discussing real world data. But its also been cited twice by the same authors seemingly incorrectly. The first citation somehow slipped past me. However, the second by<span class="citation" data-cites="liu2024"><sup>[2]</sup></span> caught my attention.</p>
<p>The paper is titled “Biological Mediators and Partial Regulatory Mechanisms on Neuropathic Pain Associated With Chemotherapeutic Agents” published in a Journal called Physiological Research. That may not seem too strange to reference our paper; after-all our paper is about chemotherapy. However, our paper doesn’t discuss neuropathic pain at all. So I hunted out a copy of the paper and tried to read it and understand what it was discussing and why they felt our paper helped their story. I confess, I managed about three lines before finding our paper in the references and locating where we were cited.</p>
<p>It turned out the only place there was a citation was in this table:</p>
<p><img src="https://www.chemo.org.uk/posts/images/Table from Ziyi etal.png" class="img-fluid">We are reference 48. Our paper doesn’t mention cabazitaxel or docetaxel at all, nor does it address Ovarian, breast lung or prostate cancer. It does discuss paclitaxel, in a very specific formulation, but like I say, we didn’t mention anything to do with neuropathy in our paper.</p>
<p>I tend to think the best of people, and I wondered if something had very innocently gone wrong in the referencing process. Perhaps a wrong digit in a DOI, or clicking the wrong paper in a reference manager.</p>
<p>While pondering quite what might have happened, I discovered the other paper<span class="citation" data-cites="wang2023"><sup>[3]</sup></span>. Same four authors. This paper is also about chemotherapy induced neuropathy. Published a year earlier. Although when you start to forensically analyse the submissions it was submitted on 5th July last year and accepted for publication 21st July. The<span class="citation" data-cites="liu2024"><sup>[2]</sup></span> paper was submitted on 15th June 2023 and accepted on the 13th September 2023. For those who maybe aren’t familiar with publishing - when you submit you are specifically asked if the paper is being considered elsewhere.</p>
<p>Of course I rushed off and read<span class="citation" data-cites="wang2023"><sup>[3]</sup></span> (well the first 3 lines!) and searched for our citation. Low and behold, the reference was on a table. We were even reference 48 again!</p>
<p><img src="https://www.chemo.org.uk/posts/images/Table from Wang etal.png" class="img-fluid"></p>
<p>By now, I was starting to be suspicious that this was not an accidental referencing error. Two almost identical articles, with identical tables, submitted in parallel. I decided to write to the editors of both Journals. The editor of Physiological Research replied relatively quickly. He was unaware of the duplicate publication and obviously defended that his reviewers couldn’t check every citation (I hadn’t expected they could!). He promised to contact the authors for explanation.</p>
<p>Interestingly, the authors responded relatively quickly to the editor. It was a single paragraph response, but it was a response. It seems that we were cited to prove that paclitaxel was actually used as chemotherapy.</p>
<blockquote class="blockquote">
<p>Reference 48 mentioned that paclitaxel and other categories of agents have been generally used for anti-cancer therapy and thus for this purpose it was cited in the table 1 of our review paper.</p>
</blockquote>
<p>As for dual publication, well it seems they don’t think that applies to review articles.</p>
<blockquote class="blockquote">
<p>Both papers are review article, but not original research paper.</p>
</blockquote>
<p>And that’s where Physiological Research have decided to leave matters. The “Cancer Therapy &amp; Oncology International Journal” have not responded at all.</p>
<p>I posted by thoughts to twitter and one of the guru’s there who spots <a href="https://en.wikipedia.org/wiki/Research_paper_mill">papermills</a> chipped in to discuss things. I wasn’t 100% sure I could label this as a papermill for picking a dubious reference and plagiarising their own text. However, he looked at the first sentence of both papers:</p>
<blockquote class="blockquote">
<p>Cancer is a leading cause of mortality worldwide[@finnerup2021].</p>
</blockquote>
<p>Now if you were going to write that sentence, you’d probably reference it to something like the World Health Organisation. Instead Liu <em>et al</em> referenced Finnerup <em>et al</em> - a paper titled “Neuropathic Pain: From Mechanisms to Treatment”. In case it is a surprise for readers, that paper doesn’t even mention cancer mortality!</p>


<section id="bibliography" class="level1 unnumbered">


</section>

<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-wadd2022" class="csl-entry">
1. Wadd, N., Peedell, C., &amp; Polwart, C. (2022). Real-World Assessment of Cancer Drugs Using Local Data Uploaded to the Systemic Anti-Cancer Therapy Dataset in England. <em>Clinical Oncology</em>, <em>34</em>(8), 497–507. <a href="https://doi.org/10.1016/j.clon.2022.04.012">https://doi.org/10.1016/j.clon.2022.04.012</a>
</div>
<div id="ref-liu2024" class="csl-entry">
2. Liu, Z., Liu, S., Zhao, Y., &amp; Wang, Q. (2024). Biological Mediators and Partial Regulatory Mechanisms on Neuropathic Pain Associated With Chemotherapeutic Agents. <em>Physiological Research</em>, <em>3/2024</em>, 333–341. <a href="https://doi.org/10.33549/physiolres.935162">https://doi.org/10.33549/physiolres.935162</a>
</div>
<div id="ref-wang2023" class="csl-entry">
3. Wang, Q. (2023). Chemotherapy-induced neuropathic pain and underlying mechanisms. <em>Cancer Therapy &amp; Oncology International Journal</em>, <em>24</em>(4). <a href="https://doi.org/10.19080/ctoij.2023.24.556142">https://doi.org/10.19080/ctoij.2023.24.556142</a>
</div>
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@misc{polwart2024,
  author = {Polwart, Calum},
  title = {Strange Citations?},
  date = {2024-08-22},
  url = {https://www.chemo.org.uk/posts/StrangeCitations.html},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2024" class="csl-entry quarto-appendix-citeas">
1. Polwart, C. (2024, August 22). Strange citations?
<em>Chemo.org.uk</em>. <a href="https://www.chemo.org.uk/posts/StrangeCitations.html">https://www.chemo.org.uk/posts/StrangeCitations.html</a>
</div></div></section></div> ]]></description>
  <guid>https://www.chemo.org.uk/posts/StrangeCitations.html</guid>
  <pubDate>Wed, 21 Aug 2024 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Prescribing of Systemic Anti-Cancer Therapies (SACT) through Primary Care in England</title>
  <link>https://www.chemo.org.uk/posters/Primary Care Prescribing.html</link>
  <description><![CDATA[ 




<p>This project started out as a simple exercise in playing with some data and showing a colleague how she might make use of <a href="https://www.r-project.org/">R</a>. I’d looked previously at some data on <a href="https://openprescribing.org">Open Prescribing</a> regarding high dose dexamethasone which I felt had no place in primary care (or possibly anywhere!) I’ve written about that before on <a href="https://www.bennett.ox.ac.uk/blog/2019/11/high-dose-dexamethasone/">TheDataLab</a>’s website. I initially suggested to Chloë that we might do an update of that data using Open Prescribing’s API. In fact, it turns out Dexamethasone 40mg Tablets have been <a href="https://dmd-browser.nhsbsa.nhs.uk/vmp/view/26671/suppliers?ref=YW1wTmFtZT1kZXhhbWV0aGFzb25lKzQwJnNlYXJjaFR5cGU9QU1QJnNob3dJbnZhbGlkSXRlbXM9ZmFsc2UmaGlkZVBhcmFsbGVsSW1wb3J0PWZhbHNlJmhpZGVTcGVjaWFsT3JkZXI9ZmFsc2UmaGlkZURpc2NvbnRpbnVlZEl0ZW1zPWZhbHNl">discontinued</a>. However, in that blog we discussed there were other “worrying” items being recorded as dispensed. Chloë felt it was worth a look and we went for a bit of dive into the data.</p>
<p>I’ve explained a bit more about the back story to the poster on this <a href="https://twitter.com/ShinyBlackShoe/status/1710268688002433134">twitter thread</a>:</p>
<p></p><div id="tweet-97871"></div><script>tweet={"url":"https:\/\/twitter.com\/ShinyBlackShoe\/status\/1710268688002433134","author_name":"Calum Polwart","author_url":"https:\/\/twitter.com\/ShinyBlackShoe","html":"\u003Cblockquote class=\"twitter-tweet\" align=\"center\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EThis \u003Ca href=\"https:\/\/twitter.com\/hashtag\/BOPA2023?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#BOPA2023\u003C\/a\u003E poster, aside from its interesting (&amp; concerning) findings, originally began as a data analysis exercise. \u003Ca href=\"https:\/\/twitter.com\/chloewaterson88?ref_src=twsrc%5Etfw\"\u003E@chloewaterson88\u003C\/a\u003E had the goal of learning some \u003Ca href=\"https:\/\/twitter.com\/hashtag\/rstats?src=hash&amp;ref_src=twsrc%5Etfw\"\u003E#rstats\u003C\/a\u003E, &amp; while I have a fondness for \uD83D\uDC27 + \uD83D\uDE97, I was eager to work with actual data. Check out the thread \uD83D\uDC47\uD83E\uDDF5 \u003Ca href=\"https:\/\/t.co\/RHbgpBBeBH\"\u003Epic.twitter.com\/RHbgpBBeBH\u003C\/a\u003E\u003C\/p\u003E&mdash; Calum Polwart (@ShinyBlackShoe) \u003Ca href=\"https:\/\/twitter.com\/ShinyBlackShoe\/status\/1710268688002433134?ref_src=twsrc%5Etfw\"\u003EOctober 6, 2023\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"};document.getElementById("tweet-97871").innerHTML = tweet["html"];</script><p></p>
<p>Perhaps easiest read on <a href="https://typefully.com/ShinyBlackShoe/un3I6EL">TypeFully</a>’s combined version.</p>
<p>Chloë’s poster was selected as a winning poster for BOPA 2023. Probably not too surprising when you consider she discovered <strong>about a million pounds</strong> of prescribing of cancer treatments that we didn’t expect.</p>
<p>PDF version of poster is available on <a href="http://dx.doi.org/10.6084/m9.figshare.23995524.v1">Fig Share</a>.</p>
<p><a href="https://figshare.com/articles/poster/Prescribing_of_Systemic_Anti-Cancer_Therapies_SACT_through_Primary_Care_in_England/23995524?file=42343227"><img src="https://www.chemo.org.uk/posters/images/primaryPrescribing.png" class="img-fluid" alt="BOPA Poster"></a></p>
<p>Chloë’s work also produced a list of cancer treatments that we felt were questionable for prescribing in primary care. The list is available on <a href="opencodelists.org/user/chloewaterson/oral-sact">Open CodeList</a>’s website if any other researchers wanted to re-use it. All Chloë’s code is available on <a href="https://github.com/Chlo115/Primary-care-SACT-use">GitHub</a> too.</p>



<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@article{waterson2023,
  author = {Waterson, Chloe and Polwart, Calum},
  publisher = {Sage Journals},
  title = {Prescribing of {Systemic} {Anti-Cancer} {Therapies} {(SACT)}
    Through {Primary} {Care} in {England}},
  journal = {Journal of Oncology Pharmacy Practice},
  volume = {30},
  number = {1\_suppl},
  date = {2023-10-06},
  url = {https://doi.org/10.1177/10781552241228011},
  doi = {10.1177/10781552241228011},
  issn = {1078-1552},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-waterson2023" class="csl-entry quarto-appendix-citeas">
1. Waterson, C., &amp; Polwart, C. (2023). Prescribing of Systemic
Anti-Cancer Therapies (SACT) through Primary Care in England.
<em>Journal of Oncology Pharmacy Practice</em>, <em>30</em>(1_suppl). <a href="https://doi.org/10.1177/10781552241228011">https://doi.org/10.1177/10781552241228011</a>
</div></div></section></div> ]]></description>
  <category>BOPA</category>
  <category>Poster</category>
  <category>Prescribing</category>
  <guid>https://www.chemo.org.uk/posters/Primary Care Prescribing.html</guid>
  <pubDate>Thu, 05 Oct 2023 23:00:00 GMT</pubDate>
</item>
<item>
  <title>NHSnames</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/NHSnameR.html</link>
  <description><![CDATA[ 





<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>When I did some work on NHS Data in R, I discovered the challenge of NHS Organisation names. Firstly, they are long and clunky:</p>
<blockquote class="blockquote">
<p>The Somewhere and Somewhere Else NHS Foundation Trust</p>
</blockquote>
<p>is hardly a snappy name. And so people abbreviate it. Often within a locality people fairly consistently abbreviate, but there will be no easy way to unpick that. Using the daft example above you could abbreviate it:</p>
<ul>
<li><p>TSSE</p></li>
<li><p>TSSE-FT</p></li>
<li><p>TSSE-NHS FT</p></li>
<li><p>SSE</p></li>
<li><p>S&amp;SE</p></li>
<li><p>S+SE</p></li>
<li><p>SSFT</p></li>
</ul>
<p>etc</p>
<p>In addition trusts can be known by their 3 letter ODS code, and it is sometimes desirable to translated the ODS code to the full name or a shortened name.</p>
</section>
<section id="r-package" class="level2">
<h2 class="anchored" data-anchor-id="r-package">R Package</h2>
<p>I have therefore created a few functions to try and make the process simpler and perhaps more consistent. And I’ve rapped these into a <a href="https://gitlab.com/polc1410/nhsnames">simple package</a>.<span class="citation" data-cites="NHSnames"><sup>[1]</sup></span></p>
<pre><code>install.packages("remotes")

remotes::install_gitlab("polc1410/nhsnames")</code></pre>



</section>

<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-NHSnames" class="csl-entry">
1. Polwart, C. (2024). <em>NHSnames: Format NHS Organisation Names for Easier Reading</em>. <a href="https://gitlab.com/polc1410/nhsnames">https://gitlab.com/polc1410/nhsnames</a>
</div>
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Data</category>
  <guid>https://www.chemo.org.uk/posts/NHSnameR.html</guid>
  <pubDate>Sat, 26 Aug 2023 23:00:00 GMT</pubDate>
</item>
<item>
  <title>SACTanalyseR</title>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/SACTanalyseR.html</link>
  <description><![CDATA[ 





<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>When I wrote <a href="..\articles/RWO-GI.html">this paper</a><span class="citation" data-cites="wadd2022"><sup>[1]</sup></span> using a collection of CSV files that had been previously submitted to the <a href="https://www.gov.uk/guidance/national-cancer-registration-and-analysis-service-ncras">National Cancer Registration and Analysis Service</a> I needed t write a few functions to handle the files. Things ranging from merging the CSV files to factorizing data and updating dates of death.</p>
<p>The dataset is in two formats - version 2 and version 3, and is fully described in published literature<span class="citation" data-cites="bright2019"><sup>[2]</sup></span>.</p>
</section>
<section id="r-package" class="level2">
<h2 class="anchored" data-anchor-id="r-package">R Package</h2>
<p>I proposed to the <a href="https://nhsrcommunity.com/">NHS R Community</a> that we could develop this set of functions into an R package, which is now released in an <em>alpha</em> version at: <a href="https://gitlab.com/polc1410/sactanalyser" class="uri">https://gitlab.com/polc1410/sactanalyser</a></p>



</section>

<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-wadd2022" class="csl-entry">
1. Wadd, N., Peedell, C., &amp; Polwart, C. (2022). Real-World Assessment of Cancer Drugs Using Local Data Uploaded to the Systemic Anti-Cancer Therapy Dataset in England. <em>Clinical Oncology</em>, <em>34</em>(8), 497–507. <a href="https://doi.org/10.1016/j.clon.2022.04.012">https://doi.org/10.1016/j.clon.2022.04.012</a>
</div>
<div id="ref-bright2019" class="csl-entry">
2. Bright, C. J., Lawton, S., Benson, S., Bomb, M., Dodwell, D., Henson, K. E., McPhail, S., Miller, L., Rashbass, J., Turnbull, A., &amp; Smittenaar, R. (2019). Data Resource Profile: The Systemic Anti-Cancer Therapy (SACT) dataset. <em>International Journal of Epidemiology</em>, <em>49</em>(1), 15–15l. <a href="https://doi.org/10.1093/ije/dyz137">https://doi.org/10.1093/ije/dyz137</a>
</div>
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Data</category>
  <guid>https://www.chemo.org.uk/posts/SACTanalyseR.html</guid>
  <pubDate>Tue, 01 Nov 2022 00:00:00 GMT</pubDate>
</item>
<item>
  <title>The Utility of an Evidence-based FAQ Document for COVID-19 Vaccination &amp; Patients receiving Systemic Anti-cancer Therapies (SACT)</title>
  <link>https://www.chemo.org.uk/posters/COVID vaccines.html</link>
  <description><![CDATA[ 




<p>This poster was presented by Nisha Shaunak at the British Oncology Pharmacy Association Annual Symposium. The poster was developed to review the effectiveness of some collaborative guidelines that were developed during the COVID-19 pandemic. The pragmatic guidelines aimed to help clinicians make sound decisions about the appropriateness of administration of COVID-19 vaccines during the early phases of the pandemic.</p>
<p>The guidelines are available on the <a href="https://www.uksactboard.org/publications">UK SACT Board Website</a>.</p>
<p><a href="http://dx.doi.org/10.13140/RG.2.2.32944.89601"><img src="https://www.chemo.org.uk/posters/images/COVID19.png" class="img-fluid" alt="COVID Vaccine Poster"></a></p>
<p>The abstracts for this meeting are published in the<a href="https://doi.org/10.1177/10781552221078082">Journal of Oncology Pharmacy Practice</a>. The poster is available <a href="http://dx.doi.org/10.13140/RG.2.2.32944.89601">on Research Gate</a>.</p>
<p>There is also a <a href="posts/building-the-vaccine-allergy-flow-chart.html">post on this site</a> describing how the flow charts for this guidance were produced in an open, accessible and version controllable format.</p>



<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@article{shaunak2021,
  author = {Shaunak, Nisha and Nijjar, Raj and Polwart, Calum and
    Enting, Deborah},
  publisher = {Sage Journals},
  title = {The {Utility} of an {Evidence-based} {FAQ} {Document} for
    {COVID-19} {Vaccination} \&amp; {Patients} Receiving {Systemic}
    {Anti-cancer} {Therapies} {(SACT)}},
  journal = {Journal of Oncology Pharmacy Practice},
  volume = {28},
  number = {2\_suppl},
  date = {2021-10-09},
  url = {https://doi.org/10.1177/10781552221078082},
  doi = {10.1177/10781552221078082},
  issn = {1078-1552},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-shaunak2021" class="csl-entry quarto-appendix-citeas">
1. Shaunak, N., Nijjar, R., Polwart, C., &amp; Enting, D. (2021). The
Utility of an Evidence-based FAQ Document for COVID-19 Vaccination &amp;
Patients receiving Systemic Anti-cancer Therapies (SACT). <em>Journal of
Oncology Pharmacy Practice</em>, <em>28</em>(2_suppl). <a href="https://doi.org/10.1177/10781552221078082">https://doi.org/10.1177/10781552221078082</a>
</div></div></section></div> ]]></description>
  <category>BOPA</category>
  <category>Poster</category>
  <category>Vaccines</category>
  <category>COVID-19</category>
  <guid>https://www.chemo.org.uk/posters/COVID vaccines.html</guid>
  <pubDate>Fri, 08 Oct 2021 23:00:00 GMT</pubDate>
</item>
<item>
  <title>A National Service Evaluation of Paclitaxel Pre-medication Regimes for the Prevention of Hypersensitivity during a period of Ranitidine Shortage - initial data analysis</title>
  <link>https://www.chemo.org.uk/posters/Paclitaxel Reactions.html</link>
  <description><![CDATA[ 




<p>This poster was presented by Emma Foreman at the British Oncology Pharmacy Association Annual Symposium. The poster summarised some work evaluating the impact of omitting ranitidine from paclitaxel infusions. Ranitidine was withdrawn from the market due to concerns about contamination. However, ranitidine had been widely considered an essential component of the premedication for paclitaxel to reduce the risk of allergic reactions.</p>
<p>Foreman, Chambers and myself collated data from a number of centres to evaluate the impact of using an alternative H2 antagonist or no antagonist. This work has subsequently been published in the <a href="https://bpspubs.onlinelibrary.wiley.com/doi/epdf/10.1111/bcp.15363">British Journal of Clinical Pharmacology</a> as described on <a href="articles/paclitaxel.html">this page of this site</a>.</p>
<p><a href="http://dx.doi.org/10.13140/RG.2.2.11080.85760/1"><img src="https://www.chemo.org.uk/posters/images/paclitaxel.png" class="img-fluid" alt="Paclitaxel allergy Poster"></a></p>
<p>The abstracts for this meeting are published in the<a href="https://doi.org/10.1177/10781552221078082">Journal of Oncology Pharmacy Practice</a>. The poster is available <a href="http://dx.doi.org/10.13140/RG.2.2.32944.89601">on Research Gate</a>.</p>



<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@article{foreman2021,
  author = {Foreman, Emma and Chambers, Pinkie and Polwart, Calum},
  publisher = {Sage Journals},
  title = {A {National} {Service} {Evaluation} of {Paclitaxel}
    {Pre-medication} {Regimes} for the {Prevention} of
    {Hypersensitivity} During a Period of {Ranitidine} {Shortage} -
    Initial Data Analysis},
  journal = {Journal of Oncology Pharmacy Practice},
  volume = {28},
  number = {2\_suppl},
  date = {2021-10-09},
  url = {https://doi.org/10.1177/10781552221078082},
  doi = {10.1177/10781552221078082},
  issn = {1078-1552},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-foreman2021" class="csl-entry quarto-appendix-citeas">
1. Foreman, E., Chambers, P., &amp; Polwart, C. (2021). A National
Service Evaluation of Paclitaxel Pre-medication Regimes for the
Prevention of Hypersensitivity during a period of Ranitidine Shortage -
initial data analysis. <em>Journal of Oncology Pharmacy Practice</em>,
<em>28</em>(2_suppl). <a href="https://doi.org/10.1177/10781552221078082">https://doi.org/10.1177/10781552221078082</a>
</div></div></section></div> ]]></description>
  <category>BOPA</category>
  <category>Poster</category>
  <category>Adverse Reactions</category>
  <category>Paclitaxel</category>
  <category>H2-Antagonists</category>
  <guid>https://www.chemo.org.uk/posters/Paclitaxel Reactions.html</guid>
  <pubDate>Fri, 08 Oct 2021 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Rates of hospital emergency admission following chemotherapy for patients undergoing review by a Non-Medical Prescriber: A useful metric for service evaluation?</title>
  <link>https://www.chemo.org.uk/posters/emergency_addmisions.html</link>
  <description><![CDATA[ 




<p>Poster presented at <a href="https://wwwbopa.org.uk">British Oncology Pharmacy Association Annual Symposium 2020</a> This poster looked to identify the rate of hospital admission following non-medical prescriber review of patients undergoing systemic anti-cancer therapy, as a measure for service evaluation of Non-Medical Prescribing Clinics.</p>
<p><a href="https://www.researchgate.net/publication/344558920_Rates_of_hospital_emergency_admission_following_chemotherapy_for_patients_undergoing_review_by_a_Non-Medical_Prescriber_A_useful_metric_for_service_evaluation"><img src="https://www.chemo.org.uk/posters/images/screenshot-www.researchgate.net-2021.03.14-22_57_15.png" class="external img-fluid"></a></p>
<p>PDF version of poster is available on <a href="http://dx.doi.org/10.13140/RG.2.2.26189.26084">Research Gate</a>.</p>



<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@article{polwart2020,
  author = {Polwart, Calum and Wadd, Nicholas},
  publisher = {Sage Journals},
  title = {Rates of Hospital Emergency Admission Following Chemotherapy
    for Patients Undergoing Review by a {Non-Medical} {Prescriber:} {A}
    Useful Metric for Service Evaluation?},
  journal = {Journal of Oncology Pharmacy Practice},
  volume = {27},
  number = {2\_suppl},
  date = {2020-10-09},
  url = {https://doi.org/10.1177/1078155220985357},
  doi = {10.1177/1078155220985357},
  issn = {1078-1552},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-polwart2020" class="csl-entry quarto-appendix-citeas">
1. Polwart, C., &amp; Wadd, N. (2020). Rates of hospital emergency
admission following chemotherapy for patients undergoing review by a
Non-Medical Prescriber: A useful metric for service evaluation?
<em>Journal of Oncology Pharmacy Practice</em>, <em>27</em>(2_suppl). <a href="https://doi.org/10.1177/1078155220985357">https://doi.org/10.1177/1078155220985357</a>
</div></div></section></div> ]]></description>
  <category>BOPA</category>
  <category>Poster</category>
  <category>Prescribing</category>
  <guid>https://www.chemo.org.uk/posters/emergency_addmisions.html</guid>
  <pubDate>Thu, 08 Oct 2020 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Geographical variation in the use of fluorouracil in the treatment of Early Breast Cancer within England</title>
  <link>https://www.chemo.org.uk/posters/fluorouracil variations.html</link>
  <description><![CDATA[ 




<p>This poster was presented by Jess Pealing at the British Oncology Pharmacy Association Annual Symposium. The poster was developed to review the variation in the use of fluorouracil in the management of Early Breast Cancer within England. The ESMO guidelines<span class="citation" data-cites="cardoso2019"><sup>[1]</sup></span>&nbsp;no longer recommend the routine use of fluoropyramidines, however, we were aware that many centres continued to use fluorouracil and we sought to identify the extent of variation.</p>
<p><img src="https://www.chemo.org.uk/posters/images/screenshot-www.researchgate.net-2021.03.14-13_59_28.png" class="img-fluid"></p>
<p>The abstracts for this meeting are published in the <a href="https://doi.org/10.1177/1078155220985357">Journal of Oncology Pharmacy Practice</a>. The poster is available <a href="https://doi.org/10.13140/RG.2.2.15860.78722">on Research Gate</a>.</p>
<p>A number of people asked following this poster how we developed the map, and we have published a simplified version of the <a href="https://www.researchgate.net/publication/344596453_Cancer_Alliance_Map_-_Simplified_Example_Code">code on Research Gate</a>.</p>




<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2">
<div id="ref-cardoso2019" class="csl-entry">
1. Cardoso, F., Kyriakides, S., Ohno, S., Penault-Llorca, F., Poortmans, P., Rubio, I. T., Zackrisson, S., &amp; Senkus, E. (2019). Early breast cancer: ESMO Clinical Practice Guidelines for diagnosis, treatment and follow-up. <em>Annals of Oncology</em>, <em>30</em>(8), 1194–1220. <a href="https://doi.org/10.1093/annonc/mdz173">https://doi.org/10.1093/annonc/mdz173</a>
</div>
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@article{pealing2020,
  author = {Pealing, Jess and Rodriguez, Marga and Polwart, Calum},
  publisher = {Sage Journals},
  title = {Geographical Variation in the Use of Fluorouracil in the
    Treatment of {Early} {Breast} {Cancer} Within {England}},
  journal = {Journal of Oncology Pharmacy Practice},
  volume = {27},
  number = {2\_suppl},
  date = {2020-10-09},
  url = {https://doi.org/10.1177/1078155220985357},
  doi = {10.1177/1078155220985357},
  issn = {1078-1552},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-pealing2020" class="csl-entry quarto-appendix-citeas">
1. Pealing, J., Rodriguez, M., &amp; Polwart, C. (2020). Geographical
variation in the use of fluorouracil in the treatment of Early Breast
Cancer within England. <em>Journal of Oncology Pharmacy Practice</em>,
<em>27</em>(2_suppl). <a href="https://doi.org/10.1177/1078155220985357">https://doi.org/10.1177/1078155220985357</a>
</div></div></section></div> ]]></description>
  <category>BOPA</category>
  <category>Poster</category>
  <category>Fluorouracil</category>
  <category>Breast Cancer</category>
  <guid>https://www.chemo.org.uk/posters/fluorouracil variations.html</guid>
  <pubDate>Thu, 08 Oct 2020 23:00:00 GMT</pubDate>
</item>
<item>
  <title>High Dose Dexamethasone</title>
  <dc:creator>Brian MacKenna</dc:creator>
  <dc:creator>Calum Polwart</dc:creator>
  <link>https://www.chemo.org.uk/posts/High-Dose-Dexamethasone.html</link>
  <description><![CDATA[ 





<p>Here is a <a href="https://www.thedatalab.org/blog/67/high-dose-dexamethasone/">link to a blog post</a>, I wrote for the guys over at TheDataLab about High Dose Dexamethasone. Data Lab tells me this was one of their most read posts. I continue to keep an eye on the dexamethasone data, and in the future will post a “live” update of that data on here.</p>



<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section></div> ]]></description>
  <category>OpenPrescribing</category>
  <category>Data</category>
  <category>Dexamethasone</category>
  <guid>https://www.chemo.org.uk/posts/High-Dose-Dexamethasone.html</guid>
  <pubDate>Thu, 28 Nov 2019 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Merging XLS Files</title>
  <link>https://www.chemo.org.uk/posts/MergingExcelFiles.html</link>
  <description><![CDATA[ 





<p>This is a very brief placeholder about merging Excel files.</p>
<p>I’ve recently been working on a project which had multiple identically structured, single sheet Excel files. These needed merging to a single file. I’ve done this with CSV files before from the command line with a batch file. Excel took a little more effort but the resulting actions are in the <a href="MergeAllFilesToCSV.zip">accompanying zip file</a>.</p>
<p>The files are first coverts by a visual basic script to CSV file (requires Excel installed on the PC); all Excel files in the folder where the file is run are converted.</p>
<p>Then the CSV files are converted by the batch script.</p>
<p>Credit for code: This is mostly code reworked slightly from Stack Overflow posts.</p>



<p>— Content on this website has been produced with reasonable care. However, errors can occur. Opinions change over time. Code that worked at the time of publication may no longer work. Users of all content from this site do so at their own risk.</p><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-copyright"><h2 class="anchored quarto-appendix-heading">Copyright</h2><div class="quarto-appendix-contents"><div>Calum Polwart and others 2020 - 2024. See Reuse section for conditions on reproduction.</div></div></section></div> ]]></description>
  <guid>https://www.chemo.org.uk/posts/MergingExcelFiles.html</guid>
  <pubDate>Sun, 11 May 2025 23:42:40 GMT</pubDate>
</item>
</channel>
</rss>
