A beginner’s guide to ‘R’ and Data Visualisation

Which graph is easier to understand?

Data visualisation is the process of representing data in a graphical or visual form, such as charts, graphs, and maps (and even tables!) to make complex information more accessible and easier to understand. Translating data into a clear visualisation helps readers identify patterns, trends, and outliers that might be missed in a text-based description of the data. Effective data visualisation allows users to quickly grasp insights, communicate findings clearly, and support data-driven decision-making across various fields, from business to academia. It is a great shortcut in helping people quickly grasp the key patterns, making information more intuitive and actionable.

What is R?

R is a powerful programming language developed for statistical computing, data analysis, and creating graphics. It is widely used among statisticians, data scientists, and researchers due to its extensive capabilities for handling and analysing data, as well as creating high-quality visualisations with endless customisation. Here’s an overview of how R is applied in data visualisation:

How is R used?

1. Data Visualisation Libraries

  • ggplot2: One of the most popular libraries in R for creating complex and aesthetically pleasing visualisations. ggplot2 follows the grammar of graphics, allowing users to layer elements to create plots, such as scatter plots, bar charts, line charts, and more. The flexibility and depth of ggplot2 make it a go-to tool for many data professionals. The #TidyTuesday crowd on Twitter and LinkedIn almost exclusively use ggplot2 and its extensions to create their visualisations. This is our Data Visualisation course leader Cara Thompson’s package of choice when creating visualisations. You can see some examples of what can be done with ggplot2 in her portfolio.
  • plotly: A library that allows for the creation of interactive plots, which can be more engaging and informative than static plots. It’s particularly useful for web-based applications and presentations. You can turn also use it to turn ggplot-plots into interactive plots!
  • sf: A powerful package for creating maps. When combined with ggplot2, this allows the same level of customisation and the interactivity associated with ggplot2, including beautiful annotations with packages such as {geomtextpath}.
  • shiny: An R package and ecosystem that enables the building of interactive web applications straight from R, often used for creating dashboards and dynamic reports with embedded visualisations.

2. Customisation and Flexibility

  • R allows for extensive customisation of visualisations, from adjusting basic elements like colour, size, and shape, to adding complex annotations and facets. Users can design plots that suit specific needs, ensuring that data is represented clearly and effectively.
  • The ability to write functions and automate repetitive tasks means that users can generate multiple plots consistently and efficiently, which is particularly useful in reporting and data exploration. This approach not only saves time, it also reduces room for human error!

3. Integration with Other Tools

  • R can be integrated with other software and programming languages, such as Python, SQL, and Excel, to make the most of each language’s strengths. For example, one can use Python’s data manipulation libraries in combination with R’s visualisation tools to streamline workflows. The advent of Quarto and Positron makes it increasingly easy to move between languages.
  • R also supports the creation of reports in various formats (HTML, PDF, Word, etc.) through tools like RMarkdown, and Quarto, which integrate code, visualisations, and narrative in a single document.

4. Advanced Statistical Visualisation

  • Beyond basic charts, R excels at creating complex statistical visualisations, such as heatmaps, boxplots, and density plots. It also supports advanced techniques like small multiples, beeswarm plots, alluvial plots, and time series analysis.
  • For those working in specialised fields, R provides packages tailored to particular types of data, such as genomic data visualisation (e.g., using the Bioconductor suite of packages).

5. Community and Resources

  • The R community is renowned for its approachability and the clarity of the resources shared online. Because many R users have come from a non-coding background, the documentation tends to be easier to understand for beginners who may not be used to reading coding tutorials. Countless tutorials, forums, and books can guide users in mastering data manipulation and data visualisation in R.
  • CRAN (The Comprehensive R Archive Network) hosts thousands of packages, providing users with tools to analyse and visualise almost any kind of data.

The Power of R for Data Visualisation

In summary, R is a comprehensive tool for data manipulation, analysis and data visualisation, providing a rich set of libraries, customisation options, and the ability to create both static and interactive visualisations. Its use in academia, industry, and research is widespread due to its ability to handle complex data and produce high-quality graphics. Whether you’re conducting exploratory data analysis or creating polished reports, R offers the tools needed to visualise data effectively.

For a tool-agnostic introduction to Data Visualisation please see the course below.

This immersive training course is designed to help you turn complex data into clear, insightful, and actionable visual representations. Whether you are a data analyst, business intelligence professional, manager, or marketer, this course will empower you to communicate your data stories compellingly and effectively.

Training Outcomes:

  • A template workflow to guide your design work
  • Visual Summary to help you select a chart type
  • Online tools to help your colour selections
  • A step-by-step guide to decluttering a chart
  • Overview of data visualisation software market
  • Learn principles to refine your designs
  • How to ensure ethical representation of data
  • Recommended CPD resource for continued learning

Browse all our training courses