Skip to contents

[Stable]

Upgrades data created by older Pmetrics versions to the current schema. In particular, the former observation-occasion column, block, is renamed to occasion throughout data frames embedded in the supplied object.

PM_upgrade() is called automatically by Pmetrics object constructors, so most users only need it when working directly with an older saved data frame or list. Re-save an upgraded object to make the conversion permanent.

Usage

PM_upgrade(x, warn = TRUE)

Arguments

x

A data frame, list, or Pmetrics R6 object to upgrade.

warn

Whether to warn when a legacy block column is converted.

Value

An upgraded copy of x.

Examples

old_data <- data.frame(id = 1, block = 1)
PM_upgrade(old_data)
#> Warning: The `block` column in Pmetrics data was deprecated in Pmetrics 3.2.7.
#>  Please use the `occasion` column instead.
#>  The object was upgraded automatically in memory. Re-save it to make this
#>   change permanent.
#>   id occasion
#> 1  1        1