bggAPI | R Documentation |
This is a class that works as a main interface to
BoardGameGeek's API. All other bgg*
classes inherit from
bggAPI
. Furthermore, there is no initialization method for
bggAPI
as it serves just as a super class for other classes.
ids
Numeric vector of positive integers. Contains IDs of all
BoardGameGeek items that were requested and are present in
data
. The vector is sorted by default.
data
Data.table with currently fetched variables from the
object's XML. It has a row count equal to the length of ids
.
Note that the copy is returned, so no modification of data
is possible outside of class methods.
xml
An XML nodeset obtained through the BoardGameGeek's API.
It's length is equal to the length of ids
.
api_url
A character vector of one or more strings with URLs used to fetch XMLs.
params
A list with object parameters.
timestamp
The date (with time) of the object creation and, what follows, the last moment that the data was certainly up to date.
fetch()
Fetches variables with given variable_names
from the
object's xml
. Returns them as a list. This is a main method of
getting non-scalar variables (as they are hard to fit into a
data.table).
bggAPI$fetch(variable_names = NULL, compress = FALSE)
variable_names
a character vector with names of variables to fetch.
compress
a logical value, decides whether the fetched variables should be compress into a scalar form (if possible).
expand()
Expands the data
table by given variable_names
by reference. For the list of available variables for every object
check the bgg_variables()
dataset.
bggAPI$expand(variable_names = NULL)
variable_names
a character vector with names of variables to add
to data
.
switch_namestyle()
Switches between two styles of naming the variables:
'classic'
and 'pretty'
. The former is a default value and
uses code names concordant with BoardGameGeek's naming convention in
the XMLs. The latter is more intuitive and uses UpperCamelCase.
bggAPI$switch_namestyle(to)
to
a single string, either 'classic'
or 'pretty'
.
Returns TRUE
or FALSE
invisibly depending on
whether the names have been switched.
clone()
The objects of this class are cloneable with this method.
bggAPI$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.