Shiny R: a request to global.R or not?

I am developing a brilliant application that connects to a database with several tables, each with several thousand rows, and in very few cases several hundred thousand rows (no more than 500,000 rows). It is planned to create an application that will be graphically represented either through diagrams (using ggplot2

and googleVis

) or through tables.

Since some pieces of data will be used multiple times in different charts or tables, my question is this: would it be more efficient (in terms of application performance) to query some of the most commonly used datasets when starting the application (in global.R ) or to query the database every time i want to make a plot ?

Here are some examples that go into more detail on the above question:

  • Case 1.
    • ABC query table once in global R and create dataframe "df"
    • Create a reactive dataset using ABC: "dataformychart".
    • Output of $ mychart using dataformychart ()
  • Case 1b
    • ABC query table once in global R and create dataframe "df"
    • print the output of $ mychart using only the required data, slicing "df" into the output of $ mychart
  • Case 2
    • create a reactive dataset named "dataformychart" and within that query the database
    • plotting $ mychart using dataformychart ()
+3


source to share





All Articles