Description Usage Arguments Examples
Run script in different versions of R and capture system time.
1 | version.time(rVersions, expr, file)
|
rVersions |
Character vector containing path to Rscript in different installations of R |
expr |
Expression to evaluate |
file |
If specified, evaluates the code in the file, rather than |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Find installed versions of Rscript
rversion <- paste(R.version$major, R.version$minor, sep = ".")
rscript <- findRscript(version = rversion)
# Configure which installed version to use
# Compute vector mean in different R installations
version.time(rscript, {
set.seed(1)
foo <- rnorm(1e4)
mean(foo)
})
# Compute matrix cross product in different R installations
version.time(rscript, {
set.seed(42)
m <- matrix(runif(100), nrow=10)
crossprod(m)
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.