Learn R Programming

UpAndDownPlots

UpAndDown plots display percentage changes by height and absolute changes by area for up to three hierarchical levels. They can visualise changes in indices, showing how the changes for sectors or for individual components contribute to the overall change.

Install in the usual way

install_github(“antonr4/UpAndDownPlots”)

Example

The Northern Ireland population grew by 3.12% between 2011 and 2017. What were the changes by the four age groups reported?

library(UpAndDownPlots)
popx <- ud_prep(NIpop, v1="y2011", v2="y2017", levs=c("age"), sortLev="orig")
p1 <- ud_plot(popx, labelvar="age")
p1$uadl

The 65+ age group increased by almost 20% and the 16-39 group actually declined. It is useful to note that the older group was less than half of the size of the 16-39 group in 2011.

There are more examples in the package vignettes.

Copy Link

Version

Install

install.packages('UpAndDownPlots')

Monthly Downloads

144

Version

0.5.0

License

GPL (>= 2)

Maintainer

Antony Unwin

Last Published

April 2nd, 2024

Functions in UpAndDownPlots (0.5.0)

UpAndDownPlots

UpAndDownPlots: display both percentage and absolute changes
sort5

Draws five UpAndDown plots for one grouping variable with the five different sorting methods provided
ud_colours

Set colours for UpAndDown plots
AutoSalesGermany

Sales of cars and vans in Germany in the years 2017 and 2018.
ud_prep

Prepares data for drawing an UpAndDown plot
ud_plot

Draws an UpAndDown plot to display percentage and absolute changes
dgroup

Draws UpAndDown plots for different grouping variables
AutoSalesXGermany

Sales of cars and vans in Germany by manufacturer (edited version of AutoSales).
ConsumerPriceIndexUK

Consumer Price Index data for the UK for August 2017 and August 2018.
NIpop

Northern Ireland population estimates 2011-2017