Serialises an sframe instrument object to a UTF-8 JSON file with a
SHA-256 integrity hash. The instrument is validated before writing unless
the object already carries a valid status. The hash is computed over the
full serialised content with the hash.value field set to an empty string.
Arguments
- instrument
An
sframeobject created bysf_instrument().- path
Character. The file path to write to. The
.sframeextension is appended automatically if not already present.- pretty
Logical. Whether to write formatted JSON with indentation. Defaults to
TRUE. Set toFALSEfor compact files.- overwrite
Logical. Whether to overwrite an existing file. Defaults to
FALSE.
Examples
instr <- read_sframe(
system.file("extdata", "tourism_services_demo.sframe",
package = "surveyframe")
)
out <- write_sframe(instr, tempfile(fileext = ".sframe"))
file.exists(out)
#> [1] TRUE