Check if a field exists in data and warn if it doesn't, then return the field value
check_field_exists(
data,
field_name,
class_name,
context = NULL,
default_value = NA
)The field value if it exists, otherwise the default_value
The data structure to check
The name of the field to check for
The name of the class being populated
Optional context information for the warning message
Value to return if the field doesn't exist (default: NA)