CppJson | R Documentation |
Wrapper around a C++ container of tree ensembles
json_ptr
External pointer to a C++ nlohmann::json object
num_forests
Number of forests in the nlohmann::json object
forest_labels
Names of forest objects in the overall nlohmann::json object
num_rfx
Number of random effects terms in the nlohman::json object
rfx_container_labels
Names of rfx container objects in the overall nlohmann::json object
rfx_mapper_labels
Names of rfx label mapper objects in the overall nlohmann::json object
rfx_groupid_labels
Names of rfx group id objects in the overall nlohmann::json object
new()
Create a new CppJson object.
CppJson$new()
A new CppJson
object.
add_forest()
Convert a forest container to json and add to the current CppJson
object
CppJson$add_forest(forest_samples)
forest_samples
ForestSamples
R class
None
add_random_effects()
Convert a random effects container to json and add to the current CppJson
object
CppJson$add_random_effects(rfx_samples)
rfx_samples
RandomEffectSamples
R class
None
add_scalar()
Add a scalar to the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$add_scalar(field_name, field_value, subfolder_name = NULL)
field_name
The name of the field to be added to json
field_value
Numeric value of the field to be added to json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which to place the value
None
add_integer()
Add a scalar to the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$add_integer(field_name, field_value, subfolder_name = NULL)
field_name
The name of the field to be added to json
field_value
Integer value of the field to be added to json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which to place the value
None
add_boolean()
Add a boolean value to the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$add_boolean(field_name, field_value, subfolder_name = NULL)
field_name
The name of the field to be added to json
field_value
Numeric value of the field to be added to json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which to place the value
None
add_string()
Add a string value to the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$add_string(field_name, field_value, subfolder_name = NULL)
field_name
The name of the field to be added to json
field_value
Numeric value of the field to be added to json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which to place the value
None
add_vector()
Add a vector to the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$add_vector(field_name, field_vector, subfolder_name = NULL)
field_name
The name of the field to be added to json
field_vector
Vector to be stored in json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which to place the value
None
add_integer_vector()
Add an integer vector to the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$add_integer_vector(field_name, field_vector, subfolder_name = NULL)
field_name
The name of the field to be added to json
field_vector
Vector to be stored in json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which to place the value
None
add_string_vector()
Add an array to the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$add_string_vector(field_name, field_vector, subfolder_name = NULL)
field_name
The name of the field to be added to json
field_vector
Character vector to be stored in json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which to place the value
None
add_list()
Add a list of vectors (as an object map of arrays) to the json object under the name "field_name"
CppJson$add_list(field_name, field_list)
field_name
The name of the field to be added to json
field_list
List to be stored in json
None
add_string_list()
Add a list of vectors (as an object map of arrays) to the json object under the name "field_name"
CppJson$add_string_list(field_name, field_list)
field_name
The name of the field to be added to json
field_list
List to be stored in json
None
get_scalar()
Retrieve a scalar value from the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$get_scalar(field_name, subfolder_name = NULL)
field_name
The name of the field to be accessed from json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which the field is stored
None
get_integer()
Retrieve a integer value from the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$get_integer(field_name, subfolder_name = NULL)
field_name
The name of the field to be accessed from json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which the field is stored
None
get_boolean()
Retrieve a boolean value from the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$get_boolean(field_name, subfolder_name = NULL)
field_name
The name of the field to be accessed from json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which the field is stored
None
get_string()
Retrieve a string value from the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$get_string(field_name, subfolder_name = NULL)
field_name
The name of the field to be accessed from json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which the field is stored
None
get_vector()
Retrieve a vector from the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$get_vector(field_name, subfolder_name = NULL)
field_name
The name of the field to be accessed from json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which the field is stored
None
get_integer_vector()
Retrieve an integer vector from the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$get_integer_vector(field_name, subfolder_name = NULL)
field_name
The name of the field to be accessed from json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which the field is stored
None
get_string_vector()
Retrieve a character vector from the json object under the name "field_name" (with optional subfolder "subfolder_name")
CppJson$get_string_vector(field_name, subfolder_name = NULL)
field_name
The name of the field to be accessed from json
subfolder_name
(Optional) Name of the subfolder / hierarchy under which the field is stored
None
get_numeric_list()
Reconstruct a list of numeric vectors from the json object stored under "field_name"
CppJson$get_numeric_list(field_name, key_names)
field_name
The name of the field to be added to json
key_names
Vector of names of list elements (each of which is a vector)
None
get_string_list()
Reconstruct a list of string vectors from the json object stored under "field_name"
CppJson$get_string_list(field_name, key_names)
field_name
The name of the field to be added to json
key_names
Vector of names of list elements (each of which is a vector)
None
return_json_string()
Convert a JSON object to in-memory string
CppJson$return_json_string()
JSON string
save_file()
Save a json object to file
CppJson$save_file(filename)
filename
String of filepath, must end in ".json"
None
load_from_file()
Load a json object from file
CppJson$load_from_file(filename)
filename
String of filepath, must end in ".json"
None
load_from_string()
Load a json object from string
CppJson$load_from_string(json_string)
json_string
JSON string dump
None
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.