Comments (11)
I think functions are cleaner. I also wanted to avoid doing NSE, although your quote
way does that. Still, imo a function is simpler for people than a quote
.
It is still not optimal, because we need to reset their environment manually, so you cannot pass a closure for example.
from callr.
I don't mind handling expressions, do you want to submit a PR? I think we can just put the expressions into a function, and then everything just works.
from callr.
I think it is cleaner to use functions, with the environment reset.
from callr.
I don't understand why ? Could you please give me an example ?
My current work-around is:
#' execute some R code via the R executable
#'
#' @param code a language object.
#' @param ... for callr::r
#'
#' @return the code evaluation
#' @export
run_r_code <- function(code, ...) {
fun <- function() {}
body(fun) <- code
callr::r(fun, ...)
}
from callr.
How do you pass an "argument" to code
?
from callr.
I can't. And I just understand now why you use functions. I had to use bquote on my expressions to pass my local vars. Makes perfect sense.
The point was to run simple commands such as run_r_code(quote(Sys.getwd())
It can be improved with : body(fun) <- substitute(code)
to be: run_r_code(Sys.getwd()).
I agree that this is only syntactic sugar, for me it felt more natural than giving a function.
from callr.
I think it can be done with expressions, but it is just way simpler with a function, and function arguments. And it is not so much more to write function() expr
than expr
.
from callr.
Definitely. As I said I missed the args passing problem. And anyway I can use my wrapper so everybody is happy ;)
Thanks again for callr. Did you know that you can tremendously speed up R CMD check using r_cmd() by setting repos to "" ? It skips the utils::available.packages network download...
from callr.
Thanks again for callr. Did you know that you can tremendously speed up R CMD check using r_cmd() by setting repos to "" ? It skips the utils::available.packages network download...
That's a good idea.
Btw. I want to "fix" the available.packages
caching problem, so that it is kept across sessions and updates properly: r-lib/crancache#14
from callr.
Btw. I want to "fix" the available.packages caching problem, so that it is kept across sessions and updates properly: r-lib/crancache#14
Very interesting indeed !
I was not aware of this r_hub project. Is it going well ? Who is driving it ?
from callr.
from callr.
Related Issues (20)
- Error in tests: `Failure ('test-rcmd.R:14:3'): rcmd echo works: `rcmd\("config", "CC", echo = TRUE\)` does not match "config\\s+CC".` HOT 8
- Upkeep for callr (2023) HOT 1
- Posit rebranding
- Upkeep for callr (2023)
- Add alt-text to pictures, plots, etc; see https://posit.co/blog/knitr-fig-alt/ for examples
- Alternative to `arch` argument with `callr` v3.3.2 HOT 2
- r_bg processes hang when waiting for others to spawn HOT 2
- How to detect failure in `r_bg()` ? HOT 1
- Release callr 3.7.4
- please do not run unsigned dll files with random names from temp folder HOT 7
- Release callr 3.7.5
- callr update from CRAN HOT 1
- callr update from CRAN HOT 2
- Rtmp files left in /tmp directory with VSCode HOT 2
- How to use customize functions in the `func` function? HOT 4
- callr update from CRAN HOT 3
- Release callr 3.7.6 HOT 1
- how to get out of session$attach() HOT 5
- Setting different R_HOME for the callr subprocess HOT 1
- r_process subclass shouldn't be cloneable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from callr.