Clean Up UI Code

I recommend a strategy similar to the ones that @jim89 suggested:

  1. create a function that calls the tabPanel code
  2. save the function in global.R (or its own separate R file which you source explicitly somewhere in the app)

If the tabPanel code will be reused in the same app then you should isolate it by creating a module instead of a function.

I found this post by @greg to be very helpful in demostrating how a ui can be simplified by grouping ui elements together in a function.

Tangentally, I've also found that once an app is 75% completed (all the features are in place, but there's still some tweaking and cleaning left to do) it's helpful to convert the app into a package and document the functions/modules. More on that here.

2 Likes