The calendars can be specified in JSON files and these functions helps with importing and exporting calendars to text files.
save_calendar(cal, con)
load_calendar(con)
the calendar's name
a connection object or a character string.
save_calendar
exports a calendar to a JSON file and
load_calendar
imports.
In load_calenadar
, the con
argument can be a connection object
or a character string specifying either the file or the JSON text.
Here's an example of a calendar's specification.
{
"name": "Brazil/ANBIMA",
"weekdays": ["saturday", "sunday"],
"holidays": ["2001-01-01", "2001-02-26", "2001-02-27", "2001-04-13"],
"adjust.from": "following",
"adjust.to": "preceding"
"financial": true,
}
con <- tempfile(fileext = ".json")
save_calendar("actual", con)
load_calendar(con)