Notice
The Notice element is used to display informational messages, warnings, or errors to the user within the jamovi results panel. They are particularly useful for alerting users to issues with their data, violations of assumptions, or providing additional context about the analysis.


Notice Types
The jmvcore::NoticeType object provides the following constants for setting the notice type:
jmvcore::NoticeType$INFO: Blue background, informational icon.jmvcore::NoticeType$WARNING: Yellow background, warning icon.jmvcore::NoticeType$STRONG_WARNING: Orange background, strong warning icon.jmvcore::NoticeType$ERROR: Red background, error icon.
Examples
1. Define the Notice in YAML
A Notice can be defined in the .r.yaml file as part of the results structure.
results:
- name: dataNote
type: Notice
2. Implementation in R
Static Definition
Setting the content of a notice defined in the YAML:
self$results$dataNote$setContent("Note: 5 cases were excluded due to missing values.")
self$results$dataNote$setType(jmvcore::NoticeType$INFO)
Dynamic Creation
Notices can also be created dynamically in R and inserted into the results tree.
if (violation) {
notice <- jmvcore::Notice$new(
options=self$options,
name='violationNotice',
type=jmvcore::NoticeType$STRONG_WARNING
)
notice$setContent("Assumption of normality was violated.")
self$results$insert(1, notice)
}