我闪亮的服务器上有一个带有日期的数据集。我创建了一个获取最大日期的变量,我需要将它传递给 UI,以便我可以将其用作日历的最大限制。我对此有疑问。df 在 server.R 文件的服务器部分之外
服务器
server <- function(input, output, session) {
date_max = max(as.Date(df.direccionamientos$D_FecDireccionamiento))
output$date_max = reactive ({ format (date_max, "%Y-%m-%d") })
outputOptions(output, 'date_max', suspendWhenHidden = FALSE)
}
用户界面
ui <- fluidPage(
tags$head(
HTML("<title>Mipres</title>"),
HTML(".shiny-notification {
position:fixed;
top: calc(0%);
left: calc(90%);
}
"
)
),
),
img(src = "saludmia-s.png", height = 110, width = 250),
titlePanel(
h1("Informes MIPRES", align = "center")),
hr(style = "border-top: 1px solid #000000;"),
fluidRow(
column(2,
titlePanel(h3("Parametros de busqueda")),
titlePanel(h4("Fecha")),
textOutput("date_max"),
condition = as.Date("output.date_max"),
airDatepickerInput(
inputId = "date2",
#label = "Select range of dates:",
range = F,
autoClose = T,
value = Sys.Date()+1 ,
# Sys.Date()),
todayButton = F,
clearButton = T,
maxDate = condition ,
addon = c("none")
),
),
#Table Showing Processed Data
# tableOutput("mytable"),
)