Masumbuko Semba

Combining plots in R

Masumbuko Semba
The ggplot2 package doesn’t provide a function to arrange multiple plots in a single figure (Wickham 2016). Still, some packages allow combining multiple plots into a single figure with custom layouts, width, and height, such as cowplot (Wilke 2018), gridExtra, and patchwork (Pedersen 2020). In this post we are going to use several packages, let’us load them in our session require(tidyverse) require(patchwork) require(cowplot) Sample datasets # tuna = tibble( # tl = runif(n = 120, min = 30, max = 120), # seasons = rep(c("Northeast", "Southeast", "Inter"), each = 40) # ) tuna = tibble( tl = c(rnorm(n = 40, mean = 80, sd = 30), rnorm(n = 40, mean = 61,10), rnorm(n = 40, mean = 96, 25)), seasons = rep(c("Northeast", "Southeast", "Inter"), each = 40) ) ridges = tuna %>% ggplot() + ggridges::geom_density_ridges(aes(x = tl, y = seasons, fill = seasons), position = "identity", alpha = .

A chord diagram in R

Masumbuko Semba
A chord diagram is a graphical representation of the data in a matrix’s interrelationships. The data is arranged in a radial pattern around a circle, with the relationships between the data points commonly depicted as arcs linking the dots (Wikipedia). Each entity is represented by a fragment on the outer part of the circular layout. Then, arcs are drawn between each entities. The size of the arc is proportional to the importance of the flow.

The State of Spatial in R

Masumbuko Semba
R is particularly powerful for spatial statistical analysis and quantitative researchers in particular may find R more useful than GIS desktop applications. As data becomes more geographical, there is a growing necessity to make spatial data more accessible and easy to process. While there are plenty of tools out there that can make your life much easier when processing spatial data (e.g. QGIS and ArcMap) using R to conduct spatial analysis can be just as easy.

Global Temperature Distribution Flat and Spherical Maps with ggplot2 in R

Masumbuko Semba
Introduction Maps are used in a variety of fields to express data in an appealing and interpretive way. Map making — the art of cartography — is an ancient skill that involves communication, intuition, and an element of creativity. Current solutions for creating maps usually involves GIS software, such as ArcGIS, QGIS, which allow to visually prepare a map. On the other hand, R, a free and open-source software development environment (IDE) that is used for computing statistical data and graphic in a programmable language, for a long time has had a relatively simple mechanism, via the maps package, for making simple outlines of maps and plotting lat-long points and paths on them.

Forecasting Rising Temperature with prophet package in R

Masumbuko Semba
Time-series analysis aims to analyse and learn the temporal behaviour of datasets over a period. Examples include the investigation of long-term records of temperature , sea-level fluctuations, the effect of the El Niño/Southern Oscillation on tropical rainfall, and surface current influences on distribution of temperature and rainfall. Th e temporal pattern of a sequence of events in a time series data can be either random, clustered, cyclic, or chaotic.