I have the following numeric input in my shiny app:
numericInput(
inputId = "beta",
label = "beta:",
value = 0.05,
step = 0.01
),
Is it possible to display in web browser "beta" as Greek symbol instead of string "beta"?
Thanks in advance.
The following works for me:
numericInput(
inputId = "beta",
label = HTML("β:"),
value = 0.05,
step = 0.01
)
so replace beta by β
and it should render in the browser as β. HTML
is used to mark the text so shiny doesnt performing escaping.
EDIT: to carry out more involved operations mathjax is useful. Here is an example of a ui.R
calling the MathJax library:
library(shiny)
shinyUI(pageWithSidebar(
# Application title
headerPanel("New Application"),
# Sidebar with a slider input for number of observations
sidebarPanel(
tags$head( tags$script(src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full", type = 'text/javascript'),
tags$script( "MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});", type='text/x-mathjax-config')
),
numericInput(
inputId = "beta",
label = HTML("$$ \\beta_1 $$"),
value = 0.05,
step = 0.01
)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
))
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