When making larger applications in RShiny
I like to keep my code in separate files for separate tabs or menus. When I place RShiny
commands within a .R
file and call it using the source()
command, a TRUE
is printed below the UI element. I have tried calling source in both ui.R
and using uiOutput()
as well as invisible()
.
How do I stop the TRUE
rendering?
Example:
app.R
library(shiny)
ui <- fluidPage(h4("Attempt 1"),
source("TestSource.R",local=T),
h4("Attempt 2"),
uiOutput("at2"),
h4("Attempt 3"),
invisible(source("TestSource.R")))
server <- function(input, output) {
output$at2 <- renderUI({
invisible(source(
"TestSource.R",
verbose = F,
echo = F,
print.eval = F,
prompt.echo = F,
local = T
))
})
}
shinyApp(ui = ui, server = server)
TestSource.R
helpText("This is a test")
Here is what this renders
Thanks in advance.
use source("TestSource.R", local=TRUE)$value
A good explanation is here
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