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

My colleague, Matt, noted that nitrile gloves are getting really expensive.

Is this real or only in his mind? Let’s check it out with Trundler.

## Setup

Load the library and set API key.

```library(trundler)

API_KEY <- Sys.getenv("TRUNDLER_KEY")

set_api_key(API_KEY)```

## Retrieve Data

Retrieve products for a specific set of SKUs. The SKUs were found by searching for product name using REGEX. Not precisely the same product as in the tweet above, but close enough.

```GLOVE_SKU <- c(
"000000000000094406",
"000000000206495002",
"000000000206495003"
)

gloves <- GLOVE_SKU %>%
map_df(function(sku) {
products(sku = sku)
})```

Now get the corresponding price data.

```prices <- gloves %>%
pull(product_id) %>%
map_df(product_prices)```

Merge the two data frames and pull out only the required columns.

```gloves <- gloves %>%
inner_join(prices) %>%
select(product, sku, time, starts_with("price"))```

## Plotting

There are three distinct products.

```# A tibble: 3 x 1
product
<chr>
1 Medic Gloves Nitrile (latex Free) Medium 100's
2 Medic Gloves Nitrile (latex Free) Small 100's
3 Medic Gloves Nitrile (latex Free) Extra Large 100's```

Let’s look at how the price for each product has changed over time.

Definitely not in his mind! The price of these gloves has been bumped up multiple times in the last year.

```# A tibble: 3 x 4
product     min_price max_price change_percent
<chr>           <dbl>     <dbl>          <dbl>
1 Extra Large     94.95     165.0          73.72
2 Medium          94.95     165.0          73.72
3 Small           94.95     165.0          73.72```

Between 4 February 2020 and 4 January 2021 the price of these gloves has increased by 73%. How do we account for this? Supply and demand? Greed?