Hi,
I have a data frame with invoice information, I basically grouped it by Invoice Date and applied a few filters saving rev_ts
.
rev_ts <- df_comb %>% filter(
`status` == "INV"
) %>% distinct(`controlno`,`sufix`,.keep_all = TRUE) %>%
mutate_at(vars(`ActualInvDate`),
funs(year, month, day)) %>%
rename("Act.Inv.Year" = `year`,
"Act.Inv.Month" = `month`,
"Act.Inv.Day" = `day`
) %>%
filter(
`Act.Inv.Year` != "1900",
`Act.Inv.Year` != "2180"
) %>%
group_by(`ActualInvDate`) %>%
summarise("Tot.Billed.Amt" = sum(`billedamt`))
The resulting data frame is something like:
# A tibble: 636 x 2
ActualInvDate Tot.Billed.Amt
<date> <dbl>
1 2018-02-20 2315.
2 2018-02-22 825.
3 2018-02-23 710.
4 2018-02-26 1032
5 2018-02-27 2519.
6 2018-03-01 5709.
7 2018-03-06 3457.
8 2018-03-09 2380.
9 2018-03-19 2515.
10 2018-03-23 1399.
# ... with 626 more rows
Following the information I found: https://www.r-graph-gallery.com/316-possible-inputs-for-the-dygraphs-library.html
# Create xts file:
rev_ts_xts <- xts(x = rev_ts$Tot.Billed.Amt, order.by = rev_ts$ActualInvDate)
# Save plot:
p <- dygraph(rev_ts_xts, main = "Total Billed Amount:") %>%
dySeries("V1", label = "$") %>%
dyLegend(show = "follow") %>% dyRangeSelector()
p
And I get the desired plot:
But when I try to have this incorporated into my flexdashboard
Rmarkdown script, I can't knit the file any longer and get the following issue:
Remove anything related to generate the Time Series, I get my flexdashboard
back working.
Any insight would be helpful since I have no idea how to troubleshoot this.
Cheers,