Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

displaying TRUE when shiny files are split into different folders

I have a shiny app using the package shinydashboard.

At first, I had all the files as 3 files - global.R, server.R, ui.R.

As files got bigger and messy, I took out the codes for each menus, and placed them in a separate folder. (splitting shiny files - http://shiny.rstudio.com/articles/scoping.html)

everything works, but there's something annoying happening - it displays 'TRUE' at the bottom of the ui of the menus I split into separate folder.

If everything is just in one big file, it doesn't display TRUE.

anyone know why this is happening?

functionally, everything is same.

like image 710
jae555 Avatar asked May 29 '15 16:05

jae555


1 Answers

What's happening is that source returns a list with 2 things inside: value which is the actual R code inside, and visible which is whether or not the code returned visibly or invisibly. The TRUE you are seeing is a reflection of the fact that the code returned visibly.

What you want to do is include the value of that list. So instead of

source("file.R", local = TRUE)

Change it to

source("file.R", local = TRUE)$value

That should fix it

like image 189
DeanAttali Avatar answered Nov 02 '22 17:11

DeanAttali