我只是Shiny中的新手,而我在Shiny中有问题。我有一个情节,但该情节没有显示闪亮。没有消息错误。这是代码...
用户界面
library(shiny)
ui = fluidPage(
titlePanel("Hello Shiny!"),
sidebarLayout(
sidebarPanel(
),
mainPanel(
uiOutput("scatter")
))
)
Run Code Online (Sandbox Code Playgroud)
服务器
library(shiny)
server = function(input, output) {
output$scatter <- renderUI({
datax <- matrix(c(1,2,3,4,5,6),6,1)
datay <- matrix(c(1,7,6,4,5,3),6,1)
titleplot<-"title"
summary <- "testing text"
pl <- plot(datax, datay, main = titleplot, xlab = "input$axis1", ylab = "input$axis2", pch=18, col="blue")
list(
pl,
summary
)
})
}
Run Code Online (Sandbox Code Playgroud) 我已阅读并从闪亮的表来实现复选框链接.但是当我在R中运行时,列中的输出在<input type="checkbox" name="row1" value="1"> , <input type="checkbox" name="row2" value="2">
每个"选择"单元格中等等,我希望"pick"列中的输出是复选框,我的问题解决方案是什么?谢谢,这是代码
library(shiny)
mymtcars = mtcars
mymtcars$id = 1:nrow(mtcars)
runApp(
list(ui = pageWithSidebar(
headerPanel('Examples of DataTables'),
sidebarPanel(
checkboxGroupInput('show_vars', 'Columns to show:', names(mymtcars),
selected = names(mymtcars))
,textInput("collection_txt",label="Foo")
),
mainPanel(
dataTableOutput("mytable")
)
)
, server = function(input, output, session) {
rowSelect <- reactive({
paste(sort(unique(input[["rows"]])),sep=',')
})
observe({
updateTextInput(session, "collection_txt", value = rowSelect() ,label = "Foo:" )
})
output$mytable = renderDataTable({
addCheckboxButtons <- paste0('<input type="checkbox" name="row', mymtcars$id, '" value="', mymtcars$id, '">',"")
#Display table …
Run Code Online (Sandbox Code Playgroud)