Skip to content

Instantly share code, notes, and snippets.

@Tadge-Analytics
Last active July 7, 2020 23:23
Show Gist options
  • Select an option

  • Save Tadge-Analytics/58a49896a5648175f95b3b61af67f653 to your computer and use it in GitHub Desktop.

Select an option

Save Tadge-Analytics/58a49896a5648175f95b3b61af67f653 to your computer and use it in GitHub Desktop.

Revisions

  1. Tadge-Analytics revised this gist Jul 7, 2020. 1 changed file with 31 additions and 8 deletions.
    39 changes: 31 additions & 8 deletions dummy financial report data.r
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,37 @@
    library(tidyverse)
    library(lubridate)

    seq.Date(today() - 400, today() + 400, 1) %>%

    actuals <- seq.Date(today() - 400, today(), "day") %>%
    tibble(Date = .) %>%
    crossing(
    `Reporting Level 1` = paste0("Level 1_", LETTERS[1:3]),
    `Reporting Level 2` = paste0("Level 2_", LETTERS[1:3]),
    `Reporting Level 3` = paste0("Level 3_", LETTERS[1:4]),
    `Fund Strm` = c("CAPEX", "OPEX")
    ) %>%
    mutate(`SAP Version` = "ACTUALS",
    Amount = runif(n(), 2, 25))




    budget <- seq.Date(today() - 400, today() + 400, "month") %>%
    tibble(Date = .) %>%
    mutate(Date = floor_date(Date, "month")) %>%
    crossing(
    `Reporting Level 1` = paste0("Level 1_", LETTERS[1:3]),
    `Reporting Level 2` = paste0("Level 2_", LETTERS[1:5]),
    `Reporting Level 3` = paste0("Level 3_", LETTERS[1:10]),
    `Fund Strm` = c("CAPEX", "OPEX"),
    `SAP Version` = c("ACTUALS", "BUDGET")
    ) %>%
    mutate(Amount = runif(n(), 2, 25)) %>%
    `Reporting Level 1` = paste0("Level 1_", LETTERS[1:3]),
    `Reporting Level 2` = paste0("Level 2_", LETTERS[1:3]),
    `Reporting Level 3` = paste0("Level 3_", LETTERS[1:4]),
    `Fund Strm` = c("CAPEX", "OPEX")
    ) %>%
    mutate(`SAP Version` = "BUDGET",
    Amount = runif(n(), 2, 25)*30)




    bind_rows(actuals, budget) %>%
    openxlsx::write.xlsx("example data.xlsx", asTable = T)


  2. Tadge-Analytics revised this gist Jul 6, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dummy financial report data.r
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    library(tidyverse)
    library(lubridate)

    seq.Date(today() - 500, today(), 1) %>%
    seq.Date(today() - 400, today() + 400, 1) %>%
    tibble(Date = .) %>%
    crossing(
    `Reporting Level 1` = paste0("Level 1_", LETTERS[1:3]),
  3. Tadge-Analytics created this gist Jul 6, 2020.
    14 changes: 14 additions & 0 deletions dummy financial report data.r
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    library(tidyverse)
    library(lubridate)

    seq.Date(today() - 500, today(), 1) %>%
    tibble(Date = .) %>%
    crossing(
    `Reporting Level 1` = paste0("Level 1_", LETTERS[1:3]),
    `Reporting Level 2` = paste0("Level 2_", LETTERS[1:5]),
    `Reporting Level 3` = paste0("Level 3_", LETTERS[1:10]),
    `Fund Strm` = c("CAPEX", "OPEX"),
    `SAP Version` = c("ACTUALS", "BUDGET")
    ) %>%
    mutate(Amount = runif(n(), 2, 25)) %>%
    openxlsx::write.xlsx("example data.xlsx", asTable = T)