due_date-option | R Documentation |
pregnancy.due_date
optionFunctions to get and set the default due date used throughout the package.
This affects calculations in various functions that determine pregnancy progress
and timing. Settings persist for the current R session only, unless added to
.Rprofile. set_due_date()
sets the "pregnancy.due_date" option and get_due_date()
retrieves it.
set_due_date(due_date)
get_due_date()
due_date |
A Date or character string representing a date, e.g. "YYYY-MM-DD", specifying the estimated due date, or NULL to unset the option. |
Both functions invisibly return the current due date setting:
get_due_date() returns the current setting (a Date object) or NULL if not set
set_due_date() returns the due date value that was set
calculate_due_date()
to calculate a due date based on other dates
how_far()
and other functions that use the due date for calculations
# Store original setting (without messages)
original_due_date <- getOption("pregnancy.due_date")
# Check current setting
get_due_date()
# Set due date and check again
set_due_date("2025-09-15")
get_due_date()
# Restore original setting (without messages)
options(pregnancy.due_date = original_due_date)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.