The error comes from the age being > 35.5 and < 36.0 with a defined height.
This case needs to be accounted for in the logic for picking a data source.
p_bp(q_sbp = 101, q_dbp = 61, age = 35.50, male = 1, height = 100)
# $sbp_percentile
# [1] 0.8105954
#
# $dbp_percentile
# [1] 0.9363363
#
p_bp(q_sbp = 101, q_dbp = 61, age = 35.50, male = 1, height = NA)
# $sbp_percentile
# [1] 0.8830374
#
# $dbp_percentile
# [1] 0.9486069
#
p_bp(q_sbp = 101, q_dbp = 61, age = 35.97, male = 1, height = 100) # ERROR
# Error in (function (set = "", age = NA_real_, male, length = NA_real_, :
# age must be between 0 and 35.5
# Error in inherits(ok, "try-error") : object 'ok' not found
p_bp(q_sbp = 101, q_dbp = 61, age = 35.97, male = 1, height = NA)
# $sbp_percentile
# [1] 0.8830374
#
# $dbp_percentile
# [1] 0.9486069
#
p_bp(q_sbp = 101, q_dbp = 61, age = 36.00, male = 1, height = 100)
# $sbp_percentile
# [1] 0.7392018
#
# $dbp_percentile
# [1] 0.8678356
#
p_bp(q_sbp = 101, q_dbp = 61, age = 36.00, male = 1, height = NA)
# $sbp_percentile
# [1] 0.8017326
#
# $dbp_percentile
# [1] 0.7668141
#
The error comes from the age being > 35.5 and < 36.0 with a defined height. This case needs to be accounted for in the logic for picking a data source.