# Creates example BorrowR data and saves to JSON file
# Created by Paul Stevenson 14-July-2018
library(RJSONIO)
library(lubridate)
data <- list(
loan_amount = 450000,
loan_start = ymd("2018/07/1"),
duration_years = 30,
rates = data_frame(
date = c(ymd("2018/07/1"), ymd("2018/07/1") + years(5), ymd("2018/07/1") + years(10)),
rate = c(4.5, 4.75, 5)
),
payments = data_frame(
date = c(ymd("2018/07/1") + months(1), ymd("2018/07/1") + months(2), ymd("2018/07/1") + months(3)),
amount = c(500, 500, 500)
),
offsets = data_frame(
date = c(ymd("2018/07/14") + months(1) + days(1), ymd("2018/07/1") + months(1) + 15, ymd("2018/07/1") + months(2) + days(7), ymd("2018/07/1") + months(2) + days(23)),
amount = c(7.50, 14, 85, 67)
)
)
cat(toJSON(format_JSON(data)), file = 'data/00001.json')
schedule <- c()
for (i in c(1:200)) {
schedule <- c(schedule, as.character(ymd("2018/07/1") + months(i)))
}
data_frame(month = c(1:200), date = ymd(schedule)) %>% tbl_df()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.