1

I have a list of objects, one of which is a prediction from a random forest model.

The data looks like :

 print(a$predict)
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 
 B  A  B  A  A  E  D  B  A  A  B  C  B  A  E  E  A  B  B  B 

I'm trying to get this printed to a shiny app.

In my server.R file I have :

output$prediction <- renderPrint({
    input$process

    withProgress(message = 'Making prediction. Please wait', value = 0.1, {

      isolate(
        print(modelset()$predict))
    })})

In my UI.R file I have :

tabPanel('Prediction', textOutput('prediction'))

The issue is that the shiny app outputs the object as 1 long string of text :

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 B A B A A E D B A A B C B A E E A B B B Levels: A B C D E

How can I get the output printed in the same way as we see in R studio?

Thanks in advance.

Leehbi
  • 789
  • 10
  • 25

1 Answers1

2

It's okay, I figured it out. I need to replace

textOutput

With

 verbatimTextOutput
Leehbi
  • 789
  • 10
  • 25