Whether to write in "ui.R + server.R" or "app.R"

They achieve the same thing. I usually like to write my real apps, that have lots of code and are complex, as two separate files to separate the logic and make it more maintainable. But when dealing with tiny apps for demo purposes or when posting an app to Stack Overflow or anywhere else, I find it's more reproducible and easier to have one statement (the app.R) approach.

Personal preference, really.


I think that app.R is better, but it's better to include your source files as the UI and server respectively, with source("file.R", local=TRUE). This way, you can separate the app into more than just 2 files while having an "overall" view of the app through the main file, like a main.cpp file in C++.

Tags:

R

Shiny