我正在尝试使用Shiny Dashboard构建和Shiny应用程序。但它一直给我一个错误,#34;论证缺失"。我已经检查了逗号,但对我来说似乎没问题。你能帮忙吗?
library(shiny)
library(shinydashboard)
library(plyr)
library(dplyr)
agency=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\agency.txt",sep=',',header=TRUE)
calendar=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\calendar.txt",sep=',',header=TRUE)
calendar_dates=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\calendar_dates.txt",sep=',',header=TRUE)
fare_attributes=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\fare_attributes.txt",sep=',',header=TRUE)
fare_rules=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\fare_rules.txt",sep=',',header=TRUE)
feed_info=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\feed_info.txt",sep=',',header=TRUE)
routes=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\routes.txt",sep=',',header=TRUE)
stop_times=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\stop_times.txt",sep=',',header=TRUE)
shapes=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\shapes.txt",sep=',',header=TRUE)
stops=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\stops.txt",sep=',',header=TRUE)
trips=read.table("C:\\Users\\Admin\\Documents\\ylikool\\statistiline visual\\trips.txt",sep=',',header=TRUE)
calendar_dates$kuup=as.Date(ISOdate(substr(calendar_dates$date,1,4),substr(calendar_dates$date,5,6),substr(calendar_dates$date,7,8)))
number=function(algkoht,loppkoht,kuupaev){
algus=stops[stops$stop_name==algkoht,c(1,3)]
lopp=stops[stops$stop_name==loppkoht,c(1,3)]
alg_trip=stop_times[stop_times$stop_id==algus$stop_id,c(1,4,5)]
lopp_trip=stop_times[stop_times$stop_id==lopp$stop_id,c(1,4,5)]
alg_trip=plyr::rename(alg_trip,replace= c("stop_id"="alg_id", "stop_sequence"="alg_jrk"))
lopp_trip=plyr::rename(lopp_trip, replace=c("stop_id"="lopp_id", "stop_sequence"="lopp_jrk"))
#common
koos=merge(alg_trip, lopp_trip, by = intersect(names(alg_trip), names(lopp_trip)))
#start before finish
koos1=filter(koos,alg_jrk<lopp_jrk)
#
t1=trips[trips$trip_id %in% koos1$trip_id,c(1,2,3,5)]
#
p=as.POSIXlt(as.Date(kuupaev))$wday
paev1=calendar[calendar$service_id %in% t1$service_id,c(1,p+1)]
paev=paev1[paev1[,p+1]==1,]
#siit vaatame kas ta erand pole sellel päeval
erand=calendar_dates[calendar_dates$service_id %in% t1$service_id & calendar_dates$kuup==kuupaev &calendar_dates$exception_type==1,1]
#paneme kokku ja võtame aint need serviced, mis siis sõidavad
kuupa=rbind(erand,paev)
tr=t1[t1$service_id %in% kuupa$service_id,]
#siit peaks saama bussinumbri
ka=routes[routes$route_id %in% tr$route_id,c(3,4)]
return(ka)
}
sidebar = dashboardSidebar(
sidebarMenu(
menuItem("Esileht", tabName = "Esileht"),
menuItem("Maaliinid", tabName = "Maaliinid")
)
)
body = dashboardBody(
tabItems(
# First tab content
tabItem(tabName = "Esileht",
fluidRow(
h1('Rakendus bussiliinide visualiseerimiseks'),
h3('Tere tulemast!'),
p('Vastavalt oma soovile vali sobiv tab ja sealt saad vajaliku info'))
),
# Second tab content
tabItem(tabName = "Maaliinid",
h2('Hinnete osakaalud erinevates valdkondades'),
box(
dateInput("Kuup",label="Vali kuupäev"),
textInput("alg",label='Vali algpeatus'),
textInput("siht",label='Vali sihtkoht'),
numericInput('kell',label='Vali kellaaeg')
),
box(
tableOutput('liinid'))
)
)
)
ui = dashboardPage(
dashboardHeader(title = "App"),
sidebar,
body
)
server <- function(input, output) {
output$liinid <- renderTable({
number(input$alg,input$siht,input$Kuup)
})
}
shinyApp(ui=ui,server= server
错误:
Warning: Error in force: argument "value" is missing, with no default Stack trace (innermost first): 65: force 64: restoreInput 63: numericInput 62: tag 61: tags$div 60: div 59: tag 58: tags$div 57: div 56: tag 55: tags$div 54: div 53: box 52: tag 51: tags$div 50: div 49: tabItem 48: lapply 47: tabItems 46: tag 45: tags$section 44: tag 43: tags$div 42: div 41: dashboardBody 1: runApp Error : argument "value" is missing, with no default
答案 0 :(得分:1)
您必须为numericInput指定一个值。只需写下:
numericInput('kell',label='Vali kellaaeg', value=4)