displaying TRUE when shiny files are split into different folders

六眼飞鱼酱① 提交于 2019-11-26 16:29:48

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/30534674/displaying-true-when-shiny-files-are-split-into-different-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!