从中的反应对象获取data.frame
我试图从一个反应对象中获得像data.frame一样的结果,但没有成功。对象类似于:从中的反应对象获取data.frame,r,shiny,reactive,R,Shiny,Reactive,我试图从一个反应对象中获得像data.frame一样的结果,但没有成功。对象类似于: textInput("artist", "Artist/Band", value = "The Beatles", width = NULL, placeholder = NULL) artist <- reactive({searchArtist(input$artist)}) 而函数searchArtist来自packageRspotify 有人吗?请参阅评论: library("Rspoti
textInput("artist", "Artist/Band", value = "The Beatles", width = NULL, placeholder = NULL)
artist <- reactive({searchArtist(input$artist)})
而函数searchArtist
来自packageRspotify
有人吗?请参阅评论:
library("Rspotify")
library("shiny")
ui=shinyUI(fluidPage(
sidebarPanel(
textInput("artist", "Artist/Band", value = "The Beatles", width = NULL, placeholder = NULL)
),
mainPanel(
textOutput("text")
)
))
server=shinyServer(function(input, output) {
artist <- reactive({
searchArtist(input$artist)
})
output$text = renderText({
data <- artist()
print(data$id)
})
})
shinyApp(ui=ui,server=server)
库(“Rspotify”)
图书馆(“闪亮”)
ui=shinyUI(fluidPage(
侧栏面板(
textInput(“艺术家”、“艺术家/乐队”,value=“披头士乐队”,宽度=NULL,占位符=NULL)
),
主面板(
文本输出(“文本”)
)
))
服务器=shinyServer(功能(输入、输出){
艺术家你能展示一个潜在的输入是什么样的吗?这可能取决于+
符号作为searchArtist
的输入。输入由:textInput(“艺术家”,“艺术家/乐队”,value=“披头士”,width=NULL,placeholder=NULL)输入“披头士”,“披头士”,“披头士”时实际上效果很好。我想这不是问题所在。错误消息是什么?看起来它应该对我有用。当我尝试提取假定data.frame的某列时,我得到:类型为“closure”的对象不可子集@Mike Wise
output$table <- renderDataTable({
inFile <- searchArtist(input$artist)
if (is.null(inFile))
inFile[2:6]
})
dataTableOutput("table")
library("Rspotify")
library("shiny")
ui=shinyUI(fluidPage(
sidebarPanel(
textInput("artist", "Artist/Band", value = "The Beatles", width = NULL, placeholder = NULL)
),
mainPanel(
textOutput("text")
)
))
server=shinyServer(function(input, output) {
artist <- reactive({
searchArtist(input$artist)
})
output$text = renderText({
data <- artist()
print(data$id)
})
})
shinyApp(ui=ui,server=server)