您好,登錄后才能下訂單哦!
R語言shiny中導(dǎo)航欄和側(cè)邊欄的示例分析,相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。
包括
基本功能是側(cè)邊欄輸入文本,在主界面以表格的形式展示出來,而且還可以把過程分為好幾個(gè)步驟,這里用到的代碼是
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可以理解為后端數(shù)據(jù)處理邏輯
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)
看完上述內(nèi)容,你們掌握R語言shiny中導(dǎo)航欄和側(cè)邊欄的示例分析的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。