Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The {saffer} package is a nascent collection of things relating to South Africa. I’ve just added fuel price data.

The {saffer} package can be installed from GitHub.

remotes::install_github("datawookie/saffer")

library(saffer)

## Background

The price of fuel in South Africa is influenced by a number of forces. Some of the most important influences are:

• International (the Base Fuel Price or BFP) — What does it cost to import fuel?

• oil price
• shipping
• exchange rate
• Domestic

• transport
• wholesale margin
• retail margin
• taxes and
• levies.

The fuel price is controlled by government and is updated on the first Wednesday of every month.

There are four main classes of fuel:

The types of petrol and diesel have evolved over the years with lower octane petrol, unleaded (ULP) and lead replacement (LRP) petrol and reduced sulphur levels in diesel.

## Fuel Prices

Fuel price data (what you’d pay at the pumps) is in the fuel_price data frame. The data extend from 4 September 1990 to 6 January 2021 and include the following types of fuel.

fuel_price %>% select(fuel) %>% distinct() %>% arrange(fuel)
# A tibble: 13 x 1
fuel

1 91 ULP
2 93
3 93 LRP
4 93 ULP
5 95 LRP
6 95 ULP
7 97
8 97 ULP
9 Diesel 0.3%
10 Diesel 0.05%
11 Diesel 0.005%
12 Illuminating Paraffin
13 Liquefied Petroleum Gas

We’ll ignore the prices of Illuminating Paraffin and Liquefied Petroleum Gas.

Here’s how the price for each of those fuel types has changed over time. Note that there is also differential pricing for coastal and inland areas, with the price being higher inland due to the extra transport costs.

## Supporting Data

In addition to the fuel price data there’s some relevant auxiliary data:

• basic fuel price (fuel_price_basic)
• price of crude oil (fuel_price_brent_crude) and
• exchange rate (fuel_price_usd_exchange_rate).

First let’s take a look at the exchange rate and price of crude oil. The South African Rand (ZAR) has fairly consistently depreciated relative to the USD. This is one contribution to the increasing fuel price.

I’ll be adding earlier crude oil prices.

And here are the various components of the Basic Fuel Price.

## Conclusion

The motivation for adding these data is that they are going to be used in some analyses that we are doing for Trundler. I hope that you find them useful too.

If R is not your thing, then you can still access these data as CSV files from https://github.com/datawookie/saffer.