I have a list shown below. I want to print it as it looks in my shiny application. I tried print(unlist(ls)) where ls is the list shown below but it just printed numbers. I also tried print.char.list from the Hmisc package but it gave error saying
Error in x[[1]][1, ] : incorrect number of dimensions.
So how can I print the names too? Thanks in advance.
$money
bankaccount cryin desperate feelin likely loaded poppin build moment
0.73 0.73 0.73 0.73 0.73 0.73 0.73 0.62 0.59
spend spent
0.51 0.51
$matter
becauseit racest spanish found whites races
0.63 0.63 0.63 0.56 0.56 0.55
$little
appropriate carrying usual
0.56 0.56 0.56
$still
cloth codes glamorous grade
0.57 0.57 0.57 0.57
How about this:
library(shiny)
mylist <- list(letters[1:4], letters[1:5], letters[1:2], letters[1:6])
server <- function(input, output) {
output$console <- renderPrint({
print(mylist)
})
}
ui <- shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
),
mainPanel(verbatimTextOutput("console"))
)
))
shinyApp(ui = ui, server = server)
At first i have created example of list of lists (as you have not provided the data in a proper format that is easy to read directly into R, please consider posting data next time correctly) and then easily printed it as an console output with renderPrint()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With