There are several different ways to make maps in R, and I always have to look it up and figure this out again from previous examples that I’ve used. Today I had another look at what’s currently possible and what’s an easy way of making a world map in ggplot2 that doesn’t require fetching data from various places. TLDR: Copy this code to plot a world map using the tidyverse:
There’s some explanation on what reshaping data in R means, why we do it, as well as the history, e.g., melt() vs gather() vs pivot_longer() in a previous post: New intuitive ways for reshaping data in R That post shows how to reshape a single variable that had been recorded/entered across multiple different columns. But if multiple different variables are recorded over multiple different columns, then this is what you might want to do:
I’ve just set up a single page website (= online business card) for myself and my husband: https://pius.cloud/ . This post summarises what I did. If you’re looking to get started with something super quickly, then only the first two steps are essential (Creating a website and Serving a website). Creating a website (using Nicepage) I’ve created websites using various tools such as straight up HTML, Wordpress, Hugo+blogdown (this site - riinu.
NA - Not Available/Not applicable is R’s way of denoting empty or missing values. When doing comparisons - such as equal to, greater than, etc. - extra care and thought needs to go into how missing values (NAs) are handled. More explanations about this can be found in the Chapter 2: R basics of our book that is freely available at the HealthyR website This post lists a couple of different ways of keeping or discarding rows based on how important the variables with missing values are to you.
TLDR: You can teach R on people’s own laptops without having them install anything or require an internet connection. Members of the Surgical Informatics team in Ghana, 2019. More information: surgicalinformatics.org Introduction Running R programming courses on people’s own laptops is a pain, especially as we use a lot of very useful extensions that actually make learning and using R much easier and more fun. But long installation instructions can be very off-putting for complete beginners, and people can be discouraged to learn programming if installation hurdles invoke their imposter syndrome.
TLDR: there are two new and very intuitive R functions for reshaping data: see Examples of pivot_longer() and pivot_wider() below. At the time of writing, these new functions are extremely fresh and only exist in the development version on GitHub (see Installation), we should probably wait for the tidyverse team to officially release them (in CRAN) before putting them into day-to-day use. Exciting! Introduction The juxtapose of data collection vs data analysis: data that was very easy to collect, is probably very hard to analyse, and vice versa.
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). More info: https://github.com/slowkow/ggrepel https://github.com/thomasp85/patchwork To really demonstrate the power of them, let’s make a global map of country names using ggrepel:
- OLDER POSTS
- page 1 of 5