cpt_export() writes a result where software in any language can
read it; cpt_import() rebuilds a working ggcpt from the
file. A saved .rds already reads in any R session without this
package (a ggcpt is a plain list of plain data), so these are for
leaving R, or for a format a person can open.
Usage
cpt_export(fit, file, format = NULL, ...)
cpt_import(file, format = NULL, method = "imported", change_in = "mean")Arguments
- fit
A
ggcptobject.- file
Path to write (
cpt_export()) or read (cpt_import()).- format
"json"(the full result, seeas_json()) or"csv"(one row per observation:index,value, the time index asindex_valuewhen there is one,seg_id,fittedandis_changepoint, which is everything needed to rebuild the segmentation but not its metadata). Defaults to the file's extension.- ...
For
cpt_export(), further arguments foras_json().- method, change_in
For a CSV, which carries no metadata, the method and change type to record on the rebuilt result. Defaults to
"imported"and"mean".
Value
cpt_export() returns file, invisibly.
cpt_import() returns a ggcpt object; the engine's own
$fit is not stored in either format, so it is NULL.
See also
Other result class:
annotate_segments(),
as_cpt_series(),
as_ggcpt(),
as_json(),
cpt_annotations(),
cpt_verify(),
ggchangepoint-conditions,
is_ggcpt(),
new_ggcpt(),
print.ggcpt()
