Please check if the PR fulfills these requirements
[x] I have read the CONTRIBUTING guidelines
[x] A new item has been added to NEWS.md
[x] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
New feature
What is the current behavior? (You can also link to an open issue here)
Linelist tagged variable loss condition are not classed.
What is the new behavior (if this is a feature change)?
Customs classes (linelist_error and linelist_warning) are added to conditions raised in case of tagged variable loss.
This enables advanced condition handling, as illustrated in the following reprex:
warning_counter <- 0
withCallingHandlers({
x <- linelist::make_linelist(cars, date_onset = "dist", age = "speed")
x <- x[, -1]
x <- x[, -1]
warning("This is not a linelist warning", call. = FALSE)
}, linelist_warning = function(w) {
warning_counter <<- warning_counter + 1
})
#> Warning: The following tags have lost their variable:
#> age:speed
#> Warning: The following tags have lost their variable:
#> date_onset:dist
#> Warning: This is not a linelist warning
warning("This pipeline generated ", warning_counter, " linelist warnings.")
#> Warning: This pipeline generated 2 linelist warnings.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Please check if the PR fulfills these requirements
[x] I have read the CONTRIBUTING guidelines
[x] A new item has been added to
NEWS.md
[x] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
New feature
Linelist tagged variable loss condition are not classed.
Customs classes (
linelist_error
andlinelist_warning
) are added to conditions raised in case of tagged variable loss. This enables advanced condition handling, as illustrated in the following reprex:No
Fix #90