Im trying to obtain results like a data.frame from a reactive object, but without sucess. The object is something like:
textInput("artist", "Artist/Band", value = "The Beatles", width = NULL, placeholder = NULL)
artist <- reactive({searchArtist(input$artist)})
Error message in this case: R shiny ERROR: object of type 'closure' is not subsettable
Where, for example, we have:
artist <- searchArtist("Regina+spektor")
str(artist)
'data.frame': 1 obs. of 6 variables:
$ id : chr "3z6Gk257P9jNcZbBXJNX5i"
$ name : chr "Regina Spektor"
$ popularity: int 65
$ genres :List of 1
..$ : chr "acoustic pop" "anti-folk" "folk-pop" "indie folk" ...
$ type : chr "artist"
$ followers : num 691496
I have also this code, which works
:
output$table <- renderDataTable({
inFile <- searchArtist(input$artist)
if (is.null(inFile))
inFile[2:6]
})
dataTableOutput("table")
And the function searchArtist
is from package Rspotify
.
Anyone?