Description Usage Arguments Value Examples
The purpose of the function is to provide a possibly seamless
way of adjusting blocks used in communication with rejustify API, in particular with the
fill
endpoint. The blocks include: data structure (structure
), default values
(default
) and matching keys (kets
). Items may only be deleted for specific matching
dimensions proposed by keys
, for the two other blocks it is possible only to change the relevant
values.
Upon changes in structure
, the corresponding p_class
or p_data
will be set to -1.
This is the way to inform API that the original structure
has changed and, if learn
option is enabled, the new values will be used to train the algorithms in the back end. If learn
is disabled, information will not be stored by the API but the changes will be recognized in the current API call.
1 |
block |
A data structure to be changed. Currently supported structures include |
column |
The data column (or raw in case of horizontal datasets) to be adjusted. Vector values are supported. |
id |
The identifier of the specific element to be changed. Currently it should be only used in |
items |
Specific items to be changed with the new values to be assigned. If the values are set to |
adjusted structure of the df
data set
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #API setup
setCurl()
#register token/email
register(token = "YOUR_TOKEN", email = "YOUR_EMAIL")
#sample data set
df <- data.frame(year = c("2009", "2010", "2011"),
country = c("Poland", "Poland", "Poland"),
`gross domestic product` = c(NA, NA, NA),
check.names = FALSE, stringsAsFactors = FALSE)
#endpoint analyze
st <- analyze(df)
#adjust structures
st <- adjust(st, id = 2, items = list('feature' = 'country'))
st <- adjust(st, column = 3, items = list('provider' = 'IMF', 'table' = 'WEO'))
#endpoint fill
df1 <- fill(df, st)
#adjust default values
default <- adjust(df1$default, column = 3, items = list('Time Dimension' = '2013') )
#adjust keys
keys <- adjust(df1$keys, column = 3, items = list('id.x' = c(3,1,2) , 'id.y' = c(1,2,3) ) )
keys <- adjust(df1$keys, column = 3, items = list('id.x' = 3 , 'id.y' = NA ) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.