atime_versions_exprs | R Documentation |
Install different git commit versions as different
packages, then create a list of expressions, one for each
version. For most use cases atime_versions
is simpler, but
atime_versions_exprs
is more flexible for the case of comparing
different versions of one expression to another expression.
atime_versions_exprs(
pkg.path, expr, sha.vec=NULL,
verbose=FALSE,
pkg.edit.fun=pkg.edit.default, ...)
pkg.path |
Path to git repo containing R package. |
expr |
code with package double-colon prefix, for example
|
sha.vec |
named character vector / list of versions. |
verbose |
logical, print messages after every data size? |
pkg.edit.fun |
function called to edit package before
installation, should typically replace instances of |
... |
named versions. |
For convenience, versions can
be specified either as code (...), data (sha.vec
), or both.
Each version should be either ""
(to use currently installed
version of package, or if missing, install most recent
version from CRAN) or a SHA1 hash, which is passed as branch
arg to git2r::checkout
; version names used to identify/interpret
the output/plots.
Each version is installed as a separate package
(to whatever R library is first on .libPaths()
),
using the package name PKG.SHA
.
A list of expressions, one for
each version, created by replacing PKG::
in expr
with PKG.SHA::
.
This list can be used as expr.list
argument of atime()
,
instead of writing code like
atime(name1=Package.SHA1::fun(argA, argB),
name2=Package.SHA2::fun(argA, argB))
.
Toby Dylan Hocking
if(FALSE){
if(requireNamespace("changepoint")){
tdir <- tempfile()
dir.create(tdir)
git2r::clone("https://github.com/tdhock/binsegRcpp", tdir)
expr.list <- atime::atime_versions_exprs(
pkg.path=tdir,
expr=binsegRcpp::binseg_normal(data.vec, max.segs),
cv="908b77c411bc7f4fcbcf53759245e738ae724c3e",
"rm unord map"="dcd0808f52b0b9858352106cc7852e36d7f5b15d",
"mvl_construct"="5942af606641428315b0e63c7da331c4cd44c091")
atime.list <- atime::atime(
N=2^seq(2, 20),
setup={
max.segs <- as.integer(N/2)
data.vec <- 1:N
},
expr.list=expr.list,
changepoint=changepoint::cpt.mean(
data.vec, penalty="Manual", pen.value=0, method="BinSeg",
Q=max.segs-1))
plot(atime.list)
}
atime::atime_versions_remove("binsegRcpp")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.