Search code examples
rdateshinyshinydashboard

R - Dashboard date in a shiny app deployed in shinyapps.io


I've created a Dashboard in Shiny that is having new data 3 times a week, so I'm trying to show the last update date of my data in the credits using the command "today()" at the time I publish it, but when someone reload the Dashboard in shinyapps.io the update date is changing to that current date.

Is there any way to fix the date when I publish it without having to write it down manually?

Here is my code:

hcmap("countries/co/co-all", showInLegend = FALSE) %>%
hc_credits(enabled = TRUE,
           text = str_c("Data Source: www.---.com.<br/> Update Date:", format(today(), format="%d/%B/%Y"), sep = " "),
           style = list(fontSize = "11px"), position = list(align = "center",y = -35))

Solution

  • I am not sure if you already got the solution or not. Here is what I recently used.

    You can use modified date of your data in UI. In global. R, use below command to get modified date of your data:

    updateDate <- format(file.info("file path")$mtime, "%Y-%m-%d")

    and then use updateDate instead of today().