Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shiny R renderText paste new line and bold

Tags:

r

shiny

I have the following:

output$count <- renderText({
#some input

    paste("Your length is:" , input$length , "Your weight is:" , weight , 
"Your age is:", age) 

I want to have three sentences, normally I would use sep="\n", but that's not working. How can I use \n or any other method to get a new line in my paste? Edit: I also would like to get the answer in bold, is that possible?

like image 372
Aanna Avatar asked Oct 11 '16 19:10

Aanna


1 Answers

Something like this?

app.R

    library(shiny)

    ui <- shinyUI(fluidPage(


       titlePanel("HTML"),


       sidebarLayout(
          sidebarPanel(
             textInput("length",
                         "Enter your length:"),
             textInput("weight",
                       "Enter your weigth:")

          ),


          mainPanel(
                  htmlOutput("testHTML")
          )
       )
    ))


    server <- shinyServer(function(input, output) {

       output$testHTML <- renderText({
               paste("<b>Your length is: ", input$length, "<br>", "Your weight is: ", input$weight, "</b>")
       })
    })


    shinyApp(ui = ui, server = server)
like image 67
Valter Beaković Avatar answered Sep 28 '22 03:09

Valter Beaković