2016-10-13 2 views
0

Я пытаюсь отобразить таблицу на главной панели, но ничего не появляется, и я не получаю сообщение об ошибке, это просто пусто. Я был бы очень признателен, если бы кто-нибудь помог мне решить это. Заранее спасибо!Таблица не отображается на вкладках mainPanel - Shiny

ui.R

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") 

       ) 


    )) 
)) 

server.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) 
     }) 
    }) 

    }) 
+1

он очень хорошо работает на моей настройке – HubertL

+0

Hubert, он создал таблицу? –

+0

У меня нет файла для проверки – HubertL

ответ

1

ошибка, кажется, получают файл:

FindTreesCHM(raster("LiDAR_CONIFERAS_chm.asc"), 3, 3) 
Error in `colnames<-`(`*tmp*`, value = c("x", "y", "height")) : 
    length of 'dimnames' [2] not equal to array extent 

Несмотря на то что ошибка существует также в виде простого R вот как я напишу реактивную блестящую часть:

data <- observe({raster(inFile$datapath)}) 
    output$mapPlot <- renderPlot({plot(data())}) 
    Arvlist <- eventReactive(input$action, {isolate(FindTreesCHM(data(), input$sws, input$hmin))}) 
    output$sumy <- renderTable({summary(Arvlist())}) 
Смежные вопросы