View source: R/endpoint_goldprice.R
| get_goldprice_from | R Documentation | 
Retrieves the gold price from a specific date.
get_goldprice_from(date)
date | 
 date from which the gold price should be fetched.  | 
As gold prices are not published on the weekends fetching values from a weekend date will result in a 404 error. In those cases the function returns an error with an appropriate message.
nbp_api_response object containing the gold price from the specified date.
Other goldprice: 
get_current_goldprice(),
get_goldprice_from_interval(),
get_last_n_goldprices(),
get_todays_goldprice()
tryCatch(
  {
    ## Fetch the gold price from a week ago
    response <- get_goldprice_from(Sys.Date() - 7)
    ## Preview response content
    response$content
  },
  error = function(e) message(e)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.