This post demonstrates the use of two very cool R packages - ggrepel and patchwork.
ggrepel deals with overlapping text labels (Code#1 at the bottom of this post):
patchwork is a very convenient new package for combining multiple different plots together (i.e. what we usually to use grid and gridExtra for).
To really demonstrate the power of them, let’s make a global map of country names using ggrepel:
I’ve been doing data science for over 10 years now. Although most of this time I didn’t realise I was doing data science. I thought I was just doing normal science but focusing on simulations and data analysis, rather than field or lab work. I’ve switched fields a few times now- physics BSc, Chemistry PhD, now working in medical research. Therefore, instead of this lenghty introduction:
“I’m a physicist by background with substantial interdisciplinary expertise in simulations, data analysis, programming…”
Day 0 (Sunday 18-February 2018) Left Edinburgh at 8am for a 1pm ferry Kennacraig to Port Askaig (Islay). Edinburgh-Kennacraig should be a 3.5h drive (and it was), but we left early to allow for any delays on the road. Arrived on Islay at 3pm and our accommodation near Port Ellen (southern Islay, close to to Ardbeg, Lagavulin, Laphroiaig) was a 40 min drive from the port.
Map of Islay with all its lovely distilleries.
Between 2014-2018 I published 29 posts on riinudata.wordpress.com. Today I’m converting all of those to my new website powered by blogdown-Hugo.
Step 1 Read the Migration: From Wordpress chapter of the blogdown book.
Step 2 Get all your wordpress posts into one XML: WP Admin - Tools - Export.
Step 3 Install Exitwp and its dependencies (pyyamp, beautifulsoup4, html2text):
git clone https://github.com/thomasf/exitwp.git sudo easy_install pip sudo pip install pyyaml sudo pip install beautifulsoup4 sudo pip install html2text This worked on macOS1 High Sierra - I already had python installed.
We are live! I wrote my last blog post on Wordpress on 20-October 2017 and promised myself this was the last time. I’ve been blogging on Wordpress since 2014 and the more I used it the more painful it got! This is most likely caused by the fact that I have been thrifting further and further away from point-and-click interfaces anyway…oh and discovering MARKDOWN.
My two rules: text is written in Markdown (I use R Markdown/knitr/bookdown, e.
I am completely obsessed with Shiny and these days I end up presenting most of my work in a Shiny app.
If it’s not worth putting in a Shiny app it’s not worth doing.
With a simple combination of mutate_if and fct_explicit_na,you can replace all NAs in all factors with “Missing”:
dplyr reference: http://dplyr.tidyverse.org/reference
forcats reference: http://dplyr.tidyverse.org/reference
To create a .bib file that only includes the citations you used in the manuscript:
bibexport -o extracted_file.bib manuscript.aux
There are a few issues with this though. The command bibexport comes with the installation of TexLive, but my Windows computer (bless) does not cooperate (“bibexport is not recognised as an internal or external command…”) . So I can only use it on my Mac (luv ya).
ggplot includes built in and seamless functionality that summarises your data before plotting it. As shown in the example below, ggplot_build() can be used to access the summarised dataset.
fill y count prop x PANEL group ... #D7301F 0.2147239 35 1 1 1 4 ... #FC8D59 0.6871166 77 1 1 1 3 ... #FDCC8A 0.9570552 44 1 1 1 2 ... #FEF0D9 1.0000000 7 1 1 1 1 ... #D7301F 0.