我正在尝试制作一个运行可执行程序的R闪亮APP . 我是新来的闪亮所以对不起,如果这个问题应该是显而易见的,但我看了,找不到任何解决我的问题 . 一切运行正常,直到调用函数runhysplit() . 我的问题是:运行以下代码时,为什么会出现以下错误:
“警告:观察者中未处理的错误:对象'输入'未找到observeEvent(输入$ runHys) . ”
library(opentraj)
library(plyr)
library(shiny)
library(shinydashboard)
source('/root/Desktop/HysplitMatcher/runhysplit.R')
ui <- {dashboardPage(
dashboardHeader(title = "HYSPLIT TRAJECTORY MATCHING TOOL", titleWidth=450),
dashboardSidebar(
sidebarMenu(
menuItem("Multiple Trajectories", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Widgets", tabName = "widgets", icon = icon("th"))
)
),
dashboardBody(
numericInput(inputId="hour.interval", label = "Hour Interval", value = 1),
numericInput(inputId="hours", label = "Total Run Time (hours)", value = -72),
selectInput(inputId ="metdata", label="Meteorology Data:", choices=c("North American Model (NAM) 00Z", "North American Model (NAM) 12Z"), selected = NULL, width = NULL),
selectInput(inputId ="location", label="Location", choices=c("Evansville", "Indianapolis Metro", "Gary", "Standiford Field (Louisville)", "South Bend")),
numericInput(inputId="height", label="Height AGL", value=100),
dateRangeInput(inputId="dates", label="Enter a date range (yyyy-mm-dd)", format="yyyy-mm-dd", separator = " to "),
numericInput(inputId="start.hour", label="Enter a staring time (hh:mm)", value = ""),
numericInput(inputId ="end.hour", label="Enter an ending time (hh:mm)", value = ""),
actionButton(inputId ="runHys", label ="RunHysplit"),
textOutput("dates")
# submitButton("Get Trajectories")
)
)
}
server <- function(input, output) {
results <- observeEvent(input$runHys, {
lat <- c(37.9772, 39.7910, 41.5956, 38.1742, 41.6725)
lon <- c(-87.5506, -86.1480, -87.3453, -85.7364, -86.2553)
locations <- c("Evansville", "Indianapolis Metro", "Gary", "Standiford Field (Louisville)", "South Bend")
latlonlook <- data.frame(lat,lon,locations)
latlonlook <- subset(latlonlook, locations == input$location)
lat <- latlonlook$lat
lon <- latlonlook$lon
cat(lat)
cat("\n")
cat(lon)
dateseq <- seq(from=input$dates[1], to=input$dates[2], by=1)
cat("\n")
cat(dateseq)
cat("\n")
cat(input$hour.interval)
cat("\n")
cat(input$metdata)
runhysplit(lat=lat, lon=lon, hour.interval=input$hour.interval, name="hysplit_fore",start.hour=input$start.hour, end.hour=input$end.hour, met="/root/Desktop/HysplitMatcher/",out="/root/Desktop/HysplitMatcher/", hours=input$hours, height=input$height, hy.path="/root/hysplit/trunk/", ID=1, dates=dateseq, metdata=input$metdata)
})
}
shinyApp(ui, server)