我试图在主面板中显示一个表格,但什么也没有出现,我也没有收到任何错误消息,它只是空白。如果有人可以帮助我解决这个问题,我将不胜感激。提前致谢!
用户界面
shinyUI(fluidPage(
titlePanel(title=h2("Deteccao de arvores individuais de LiDAR em Shiny App - R", align="center")),
headerPanel(title=h4("Defina seus parametros e preferencias")),
sidebarLayout(
sidebarPanel(
fileInput('layer', 'Select the CHM.asc file', multiple=FALSE, accept='asc', width = "350px"),
textInput("hmin", "Select the minimum height for trees (m)", value="", width = "350px"),
selectInput("fws", "Select the size of windows to find trees", choices = c("3x3"= (sws<-3), "5x5"= (sws<-5), "7x7"= (sws<-7)), width = "350px"),
wellPanel(checkboxInput("checkbox", "Would you like to apply the smoothing model for canopy?", value = FALSE, width = "350px"), uiOutput("conditionalInput")),
actionButton("action", "RUN!")
# selectInput("color", "Define the CHM color", "green"), plotOutput("chmcol")),
# wellPanel(checkboxInput("checkp1", "Plot CHM in 3D", value=FALSE, width="350px", uiOutput("chm3D"))),
# wellPanel(checkboxInput("checkp2", "Plot individual trees in 3D", value = "350px", uiOutput("arv3D")))
),
mainPanel(
tabsetPanel(type="tab",
tabPanel("Visualization of CHM", plotOutput("mapPlot")),
tabPanel("Summary of LiDAR metrics", tableOutput("sumy")),
tabPanel("Profile of height model"), #histograma de densidade
tabPanel("Individual trees detected - Model 2D of CHM"),
tabPanel("Individual trees detected - Model 3D of CHM"),
tabPanel("Individual trees detected - Model 3D of Single trees")
)
))
))
服务器.R
if(Sys.getenv('SHINY_PORT') == "") options(shiny.maxRequestSize=10000*1024^2)
shinyServer(function(input, output) {
output$mapPlot <- renderPlot({
inFile <- input$layer
if (is.null(inFile))
return(NULL)
data <- raster(inFile$datapath)
plot(data)
})
output$conditionalInput <- renderUI({
if(input$checkbox){
selectInput("sws", "Select the size of the smoothing window for trees", choices = c("3x3"= (sws<-3), "5x5"= (sws<-5), "7x7"= (sws<-7)), width = "350px")
}
})
output$sumy <- renderTable({
input$act
if(is.null(input$act))
return(NULL)
else
isolate({
Arv.List <- FindTreesCHM(output$mapPlot, input$sws, input$hmin)
sum <- summary(Arv.List)
head(sum)
})
})
})