您好,登錄后才能下訂單哦!
R語言shiny中導航欄和側邊欄的示例分析,相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現的原因和解決方法,通過這篇文章希望你能解決這個問題。
包括
基本功能是側邊欄輸入文本,在主界面以表格的形式展示出來,而且還可以把過程分為好幾個步驟,這里用到的代碼是
withProgress(message = "Steps:",value = 0,{incProgress(1/7,detail = paste0("Waitting","1")),incProgress(2/7,detail = paste0("Waitting","2"))}
ui可以簡單理解為前端頁面
library(shiny)
ui<-navbarPage('Pomegranate',inverse = T,collapsible = T,
tabPanel("Gene Ontology",
sidebarLayout(
sidebarPanel(width = 2,textAreaInput("text_area_list",
label = "Please input protein id, one per line",
height = "200px",
width="180px",
value="Pg00001"),
selectInput('id_type',label="Input gene-id Type:",
selected = "A",choices = c("A","B","C")),
helpText("You are!"),
numericInput("pval_cutoff",label = "pvalue-Cutoff",
value=1,min = 0.001,max=1,step = 0.001),
numericInput("qval_cutoff",label="qvalue-CutOff",value=1,
min = 0.001,max=1,step=0.001),
hr(),
helpText("After submit it may take 1-2 minutes. Check Progress bar in right side cornor"),
actionButton("submit",label = "Submit",icon=icon('angle-double-right')),
tags$hr()),
mainPanel(
helpText("Note: After submit it may take 1-2 minutes. Check Progress bar in right side cornor."),
tags$hr(),
textOutput("gene_number_info"),
tags$hr(),
DT::dataTableOutput(outputId = "gene_number_info_table")
)
)))
server可以理解為后端數據處理邏輯
server<-function(input,output){
observeEvent(input$submit,{
withProgress(message = "Steps:",value = 0,{
incProgress(1/7,detail = paste0("Waitting","1"))
text_area_input <- input$text_area_list
df<-as.data.frame(matrix(unlist(stringr::str_split(text_area_input,"\n")),ncol=1))
print(class(text_area_input))
print(text_area_input)
incProgress(2/7,detail = paste0("Waitting","2"))
output$gene_number_info<-renderText({
paste0("A","B")
})
output$gene_number_info_table<-DT::renderDataTable({
DT::datatable(df)
})
})
})
}
shinyApp(ui=ui,server=server)
看完上述內容,你們掌握R語言shiny中導航欄和側邊欄的示例分析的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。