| cpt_export | R Documentation |
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.
cpt_export(fit, file, format = NULL, ...)
cpt_import(file, format = NULL, method = "imported", change_in = "mean")
fit |
A |
file |
Path to write ( |
format |
|
... |
For |
method, change_in |
For a CSV, which carries no metadata, the method
and change type to record on the rebuilt result. Defaults to
|
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.
Other result class:
annotate_segments(),
as_cpt_series(),
as_ggcpt(),
as_json(),
cpt_annotations(),
cpt_verify(),
ggchangepoint-conditions,
is_ggcpt(),
new_ggcpt(),
print.ggcpt()
set.seed(1)
fit <- cpt_detect(c(rnorm(50), rnorm(50, 3)), method = "pelt")
path <- tempfile(fileext = ".json")
cpt_export(fit, path)
back <- cpt_import(path)
back$changepoints
unlink(path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.