Articles by R on Thomas' adventuRe

{ggcharts 0.2.0} is on CRAN

May 17, 2020 | R on Thomas' adventuRe

Introduction A week ago the second release of my {ggcharts} package was published on CRAN. {ggcharts} aims to get you to your desired plot faster. It provides a high-level interface for creating common plots using {ggplot2} and does the heavy lifting for you. The resulting plots are ggplot objects so ...
[Read more...]

Adding labels to a ggplot2 bar chart

April 5, 2020 | R on Thomas' adventuRe

I often see bar charts where the bars are directly labeled with the value they represent. In this post I will walk you through how you can create such labeled bar charts using ggplot2. The data I will use comes from the 2019 Stackoverflow Developer Survey. To make creating the plot ...
[Read more...]

Transform a ggplot2 axis to a percentage scale

April 4, 2020 | R on Thomas' adventuRe

When plotting a variable whose unit of measure is percent it’s best practice to have the axis labels contain the percentage sign (%). This makes it obvious to anyone looking at the data visualization that they are dealing with percentages. To illustrate this let’s create an example dataset. library(...
[Read more...]

Getting R to print English error messages

March 20, 2020 | R on Thomas' adventuRe

If you live in a non-English locale such as I do, you’ll likely receive error messages in your locale language when things go wrong in R. 1 + "r"
## Error in 1 + "r": nicht-numerisches Argument für binären Operator
This is a problem because it highly limits the results when searching for error messages on Google. Have you ever read ... [Read more...]

A case for the assign() function

March 19, 2020 | R on Thomas' adventuRe

In R, assign() is one of those functions that common wisdom says you shouldn’t be using. My aim in this blog post is to convince you that assign() can be very handy. The pharmaceutical industry, which I work in, is still SAS dominated so my primary data source at ... [Read more...]

Streamline your dplyr chains with count()

March 5, 2020 | R on Thomas' adventuRe

If you frequently use chains like this data %__% group_by(var1, var2) %__% summarise(n = n()) consider using count(data, var1, var2) instead. It produces the same output, you need to type less and the code is more expressive. By default, the column containing the count will be named n. Want ... [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)