Skip to contents

This function writes the csv file of labelled activity and pressure which can be read with TRAINSET (e.g., with trainset()). If no label data exist, it will first initialize the labels with tag_label_auto().

Optionally, it can also export a reference dataset for pressure tag$pressure$value_ref as another series to be visualized on TRAINSET, but without impacting the labelling process.

Usage

tag_label_write(
  tag,
  file = glue::glue("./data/tag-label/{tag$param$id}.csv"),
  quiet = FALSE
)

Arguments

tag

a GeoPressureR tag object.

file

Absolute or relative path of the label file to be saved.

quiet

logical to hide messages.

Value

The file pathname is returned invisibly

Examples

withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
  tag <- tag_create("18LX", quiet = TRUE)

  # Writing unlabelled tag will initialize the labelling for trainset
  tag_label_write(tag, file = tempfile(fileext = ".csv"), quiet = TRUE)

  # Writing an auto-labelled tag
  tag <- tag_label_auto(tag)
  tag_label_write(tag, file = tempfile(fileext = ".csv"), quiet = TRUE)

  # Writing labelled tag will use the existing labels
  tag <- tag_label(tag, quiet = TRUE)
  tag_label_write(tag, file = tempfile(fileext = ".csv"), quiet = TRUE)
})