R Shiny execute order -


i new shiny (and r matter) have managed app , running.

i quite confused regarding "execution order" takes place when rstudio runs 2 scripts server.r , ui.r

to mind there 4 sections of code (2 server.r script , 2 ui.r script):

server.r:

###### section 1  shinyserver(function(input, output, session) {     ###### section 2   }) 

ui.r:

###### section 1  shinyui(fluidpage(    ###### section 2  ) ) 

my question is, assuming have above correct, sections run first, second, third, etc?

add print statement in each section , run rstudio. message displayed in console. got

[1] "section 1 of ui" [1] "section 2 of ui" [1] "section 1 of server" [1] "section 2 of server" 

as object access, tried following , see variables in each environment.

ui.r

vardefinedinsec1ui <- 1  print("* section 1 of ui") cat(ls(), "\n\n")  shinyui(fluidpage(   vardefinedinsec2ui <- 2,    print("* section 2 of ui"),   cat(ls(), "\n\n") )) 

server.r

vardefinedinsec1server <- 3  print("* section 1 of server") cat(ls(), "\n\n")  shinyserver(function(input, output, session) {   vardefinedinsec2server <- 4    print("* section 2 of server")   cat(ls(), "\n\n") }) 

i got:

[1] "* section 1 of ui" vardefinedinsec1ui   [1] "* section 2 of ui" vardefinedinsec1ui vardefinedinsec2ui   [1] "* section 1 of server" vardefinedinsec1server   [1] "* section 2 of server" input output session vardefinedinsec2server  

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -