How to create graphs with ggplot2 in R

Package The packages are additional functionalities that can be installed to Rstudio. Think of the apps on your phone, which can do different things. There are several ways to install them, but the simplest is through a package called pacman, but first we need to install the package pacman if (!require("pacman")) install.packages("pacman") Then, every time we need a new package, we invoke the command by pacman::p_load(tidyverse, palmerpenguins) The packages are installed only once (just like the apps on your phone), but you need to call them every time you want to use them (just like the apps on your phone) [Read More]

How to create graphs with ggplot2 in R

Package The packages are additional functionalities that can be installed to Rstudio. Think of the apps on your phone, which can do different things. There are several ways to install them, but the simplest is through a package called pacman, but first we need to install the package pacman if (!require("pacman")) install.packages("pacman") Then, every time we need a new package, we invoke the command by pacman::p_load(tidyverse, palmerpenguins) The packages are installed only once (just like the apps on your phone), but you need to call them every time you want to use them (just like the apps on your phone) [Read More]

ggplots tips and tricks

Is your background a different color than white? Use a transparent background: ggsave("myplot.tiff", dpi = 300, plot = myplot, bg = "transparent") To save your images in a high quality format that can be scaled for printing in a magazine or on a poster ggsave("myplot.tiff", dpi = 300, plot = myplot) Match your poster aesthetic with scale_fill_manual(values = c("#__", "#__", etc) Check this also Need more adjustments for your graph? [Read More]

Visualizing the dental workforce of OECD countries I

The Organisation for Economic Co-operation and Development host a database with extensive data. In this post we will do some visualizations to compare the number of dentists in each country. Packages used: tidyverse gghighlight kableExtra First we load the data. Now there is a package (OECD) able to extract the datasets, but I will use a local copy: dent_oecd <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vStv7Pr69DtRKv6Nw6gVBep8hbT3pEeO6B1vNwxK_1DUHgpoTgbuRpZ4SvgtHFQnBZJVGeeQVyRuXZl/pub?gid=1330297229&single=true&output=csv") ## Parsed with column specification: ## cols( ## VAR = col_character(), ## Variable = col_character(), ## UNIT = col_character(), ## Measure = col_character(), ## COU = col_character(), ## Country = col_character(), ## YEA = col_double(), ## Year = col_double(), ## Value = col_double(), ## `Flag Codes` = col_character(), ## Flags = col_character() ## ) Always is preferable to take a look the data and its structure: [Read More]