export_emulator_to_json: Export Emulators

export_emulator_to_jsonR Documentation

Export Emulators

Description

Exports emulators to non-R format

Usage

export_emulator_to_json(
  ems,
  inputs = NULL,
  filename = NULL,
  output.type = "json"
)

Arguments

ems

The (list of) emulators to convert

inputs

Any previous information from compressed emulators (mostly internal)

filename

If provided, the location to save the JSON file created

output.type

If filename = NULL, whether to return the JSON ("json") or object.

Details

While having emulators saved in a native-R format (for example, as part of an RData file) can be useful for fast loading, it might be prohibitive where space is a consideration, or where emulators might be imported into other languages. This function summarises the key features of deterministic emulators, either returning the compressed details as an object or returning a JSON file. If a filename is provided, then the JSON is automatically saved to the relevant location.

Value

Either the created object, or NULL if a filename is specified.

See Also

import_emulator_from_json

Examples

# Using the SIREmulators
ems <- SIREmulators$ems
single_em_json <- export_emulator_to_json(ems[[1]], output.type = "json")
single_em_json
all_em_json <- export_emulator_to_json(ems, output.type = "json")
# Checking with the corresponding import function
reconstruct_em <- import_emulator_from_json(single_em_json)
ems[[1]]
reconstruct_em


Tandethsquire/hmer documentation built on Oct. 25, 2024, 11:09 a.m.