knitr::opts_chunk$set(echo = TRUE, comment = NA) options(trundler.chatty = FALSE) # options(tibble.width = Inf)
Trundler provides access to product and historical price data from a range of online retailers.
The homepage for the {trundler} R package is at https://datawookie.github.io/trundler/.
Install from GitHub.
remotes::install_github("datawookie/trundler")
If you want to be closer to the bleeding edge then you can also install from the development branch.
remotes::install_github("datawookie/trundler", ref = "dev")
library(trundler)
Check version.
packageVersion("trundler")
To access the full API you'll need to first specify an API key.
# Example API key (this key will not work). set_api_key("8f9f3c4e-5dd6-4bff-3a2c-592b45cf2437")
set_api_key(Sys.getenv("TRUNDLER_KEY"))
To obtain a key, please get in touch. Contact details are in DESCRIPTION
.
You can also subscribe via RapidAPI.
# Example RapidAPI key (this key will not work). set_api_key("5a1ae0ce24mshd483dae6ab7308dp129ef6jsn1f473053d6b0")
Use retailer()
to get a list of retailers.
retailer()
Or you can acccess the details for a specific retailer.
retailer(45)
Get a list of products for a specific retailer.
retailer_products(5)
Products can be filtered by name and brand.
retailer_products(5, product = "coffee", brand = "nespresso")
A similar search can be applied across all retailers.
products(product = "hand sanitiser") products(product = "coffee", brand = "nespresso|nescafe") products(product = "tv", brand = "samsung|hisense")
Information on a specific product.
item <- product(530290)
What fields are available?
names(item)
Get product name, SKU and barcodes.
item$product item$sku item$barcodes
Get price history data for a specific product.
product_prices(530290)
You can control the volume of console output with options:
options(trundler.chatty = TRUE)
: provide more output; andoptions(trundler.chatty = FALSE)
: provide less output.You can use the Trundler RMarkdown template to quickly produce visualisations for product price histories. After installing the package, select "Trundler Report Template" under the "From Template" option on the New RMarkdown dialog.
Note: You might need to restart RStudio before the template shows up in the menu.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.