Do I need to write in "ui.R + server.R" or "app.R"

We can write our Brilliant code in two separate files "ui.R"and "server.R", otherwise, we can write both modules in one file "app.R"and call the functionshinyApp()

Is there any performance benefit with either of the two approaches, or should we choose one based on whether we want compressed code or differentiated code?

+4
source share
2 answers

I think it’s app.Rbetter, but it’s better to include the source files as an interface and server, respectively, with source("file.R", local=TRUE). Thus, you can separate the application from more than two files, having a general view of the application through the main file, for example, a file main.cppin C ++.

+3
source

They achieve the same. I usually like to write my real applications, which have a lot of code and are complex, like two separate files, to separate the logic and make it more convenient. But when working with tiny applications for demo purposes or when submitting an application to SO or elsewhere, I find it more acceptable and easier to have one approach (app.R).

Personal preferences, really.

+8
source

Source: https://habr.com/ru/post/1598383/


All Articles