Skip to contents

The function is a wrapper of osrs_api() that returns a tibble which is easier to work with than the list object from the osrs_api function.

Usage

create_item_data(items, history = "all", user_agent = "GE_price_tracker")

Arguments

items

character vector of the items

history

character with type of request. Default is latest, but all is also available

user_agent

character of the user agent

Value

A tibble with information about items, prices, dates

Examples

# Create a data set with information about the item
create_item_data(items = "Abyssal_whip", history = "all")
#> # A tibble: 3,349 × 6
#>    item         id      price rel_day date       volume
#>    <chr>        <chr>   <int>   <dbl> <date>      <int>
#>  1 Abyssal whip 4151  1427376       0 2024-08-08   4029
#>  2 Abyssal whip 4151  1420501       1 2024-08-07   5395
#>  3 Abyssal whip 4151  1420170       2 2024-08-06   8069
#>  4 Abyssal whip 4151  1425946       3 2024-08-05  10896
#>  5 Abyssal whip 4151  1427688       4 2024-08-04   6103
#>  6 Abyssal whip 4151  1432482       5 2024-08-03   8532
#>  7 Abyssal whip 4151  1427638       6 2024-08-02   4836
#>  8 Abyssal whip 4151  1437844       7 2024-08-01  10011
#>  9 Abyssal whip 4151  1403246       8 2024-07-31   8122
#> 10 Abyssal whip 4151  1401991       9 2024-07-30   7231
#> # ℹ 3,339 more rows

# Same can be done for other values of history
create_item_data(items = c("bucket", "Abyssal whip"), history = "latest") |>
create_item_data(items = c("Dragon dagger"), history = "sample")
#> Error in purrr::map(items, osrs_api, history = history, user_agent = user_agent):  In index: 1.
#> Caused by error in `httr::user_agent()`:
#> ! is.character(agent) is not TRUE