Sourcing external R scripts that rely on the variable set in the Shiny main / main document

I just installed the preliminary release of RStudio, version 0.98.864 (May 24, 2014). In addition, I installed knitr development versions and brilliant using

devtools::install_github(c("yihui/knitr", "rstudio/shiny"))

I am trying to create a brilliant document (using the Rstudio dialog with the Shiny Document template) so that:

1) Set the value of the variable, for example. X. The following code is the contents of my Rmd file: (I have to put this as an image when playing formatting) enter image description here

2) The source of the R script (testExternalisation.R) in the same directory that uses the variable x set in the .Rmd file; code as follows:

y <- x + 3

.Rmd : ": " x " . , .Rmd , Shiny html_document, .Rmd. Shiny Documents, Shiny Doc?

. () <environment: R_GlobalEnv> .Rmd .R. Shiny .Rmd <environment: 0x05828968>, <environment: R_GlobalEnv>, , ...

.

+4
1

, : source()

source("testExternalisation.R", local=environment())
+5

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


All Articles