r-environment

Use `rmarkdown::render` in a restricted environment

…衆ロ難τιáo~ 提交于 2021-02-06 15:52:50
问题 I have the following Rmd file I called test.Rmd : --- title: "test" output: html_document --- ```{r} print(y) ``` ```{r} x <- "don't you ignore me!" print(x) ``` I want to call render the following way: render('test.Rmd', output_format = "html_document", output_file = 'test.html', envir = list(y="hello")) but it fails: processing file: test.Rmd |................ | 25% ordinary text without R code |................................ | 50% label: unnamed-chunk-1 |.................................

Use `rmarkdown::render` in a restricted environment

冷暖自知 提交于 2021-02-06 15:52:10
问题 I have the following Rmd file I called test.Rmd : --- title: "test" output: html_document --- ```{r} print(y) ``` ```{r} x <- "don't you ignore me!" print(x) ``` I want to call render the following way: render('test.Rmd', output_format = "html_document", output_file = 'test.html', envir = list(y="hello")) but it fails: processing file: test.Rmd |................ | 25% ordinary text without R code |................................ | 50% label: unnamed-chunk-1 |.................................

R Shiny - dataset load in a first chunk doesn't exist in a second chunk …?

 ̄綄美尐妖づ 提交于 2020-01-06 05:01:48
问题 I have a strange error in a shiny app I built with the library learnr . An error " Object not found " about an object I just loaded and just visualized (meaning the object exists no ?) Although I don't have a reproducible example, some of you will maybe understand what is creating the error : I have a first chunk {r load} that loads a dataset. There is no error here, I can even visualize the dataset (screenshot below) Then I have a second chunk, where I would like to manipulate the dataset.

R passing RSelenium driver environment as function argument

狂风中的少年 提交于 2019-12-24 01:18:02
问题 i'm probably not seeing something obvious, anyway i'd like to create functions to automatically extract text from an url already handled by a remote driver. I'd like to pass as a function arguments the xpath expression and the environment into which the remote driver could be found library(RSelenium) url="http://stackoverflow.com/search?q=r+program" remdir<-remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "firefox") remdir$open() remdir$navigate(url) env<-environment()

Source script to separate environment in R, not the global environment

与世无争的帅哥 提交于 2019-11-27 13:58:32
问题 Is there a way to source() a script in R such that it is attached as a parent to the global environment ( .GlobalEnv )? Currently, when I source a script, all variables and functions of that script appear in my global (interactive) environment. I'd like to include these variables and functions in the search path, but not in .GlobalEnv . That is, I'd like the sourced script to behave like an attached package, which gets attached between the global and base environments (see figure from