getRanks: Retrieve product ranks.

View source: R/getRanks.R

getRanksR Documentation

Retrieve product ranks.

Description

getRanks requests rank data for specific products from the appFigures API.

Usage

getRanks(product_ids, country = "US", category, end_date, start_date,
  filter = 400, granularity = c("daily", "hourly"), tz = c("utc",
  "est", "user"), curlHandle, verbose = FALSE, orgJSON = FALSE,
  async = FALSE, agroups = 2)

Arguments

product_ids

Numeric. A vector of appFigures-assigned product ids.

country

Character. One or more country iso abbreviations that filter which countries rank data to include. Defaults to "US".

category

An atomic character or numeric vector. See Details.

end_date

Character string or date object. Date of last ranks to be reported. Defaults to today. See Details.

start_date

Character string or date object. Date of first ranks to be reported. Defaults to 31 days prior to the end_date. See Details.

filter

Limit results to ranks in the top N with N being a number between 1 and 400. A filter value of 100 will only show records that are ranked 1 - 100. Defaults to 400.

granularity

Character. Should ranks be reported on a daily or hourly basis.

tz

Character. Specifies which timezone to use. Defaults to utc.

curlHandle

Provide an instance of the CURLHandle-class from the RCurl package. The default will create a curl handle specific to the function call.

verbose

Logical. Should details of the web request print to the console? Defaults to FALSE.

orgJSON

Logical. Should the JSON string be returned with out being converted to R objects? Defaults to FALSE.

async

Logical. Should the given product ids be split up into groups and and run concurrently? Defaults to FALSE.

agroups

Integer. The number of concurrent calls to make.

Details

The category argument is not included in the web request. Subsetting the returned rank data on this argument occurs after the data has been transformed into R objects and is included purely as a convenience. Details on store categories can be requested using getStoreData.

For start_date and end_date, if the supplied argument can be interepreted as a date or POSIX object, any hour, minute, or second is ignored. If a string is supplied, it should have the format: 'yyyy-MM-dd'.

Value

Depends on the selected options. If orgJSON = F, a data.frame is returned. If orgJSON = T, a character vector of json strings is returned, the length of which is determined by the integer specified by agroups.

See Also

Official documentation: http://docs.appfigures.com/api/reference/v2/ranks.


appfigures/afapi documentation built on Nov. 13, 2022, 9:27 a.m.