rticulate / import

An Import Mechanism For R
https://import.rticulate.org
Other
222 stars 14 forks source link

Version specification in import::from #7

Closed ashander closed 7 years ago

ashander commented 9 years ago

As mentioned on twitter by @noamross specifying a version for a package function could improve script reproducibility.

Looking at your source for import::from, https://github.com/smbache/import/blame/master/R/from.R#L108 implementing seems straightforward using the versionCheck argument of loadNamespace (which I've only just discovered).

PS: a brief look on Google indicates actually using versionCheck may be a bit tricky. See this thread: http://r.789695.n4.nabble.com/Problem-understanding-behaviour-of-versionCheck-for-loadNamespace-and-when-versions-for-Imports-pack-td4700099.html

smbache commented 9 years ago

First attempt at this is included in latest push; the following are valid (spaces are irrelevant in the specification):

import::from("magrittr(>= 1.5)", "%>%")
import::from("magrittr (>=1.5)", "%>%")
import::from("magrittr(== 1.5)", "%>%")
import::from("magrittr(1.5)", "%>%")   # same as (==1.5)
import::from("magrittr(!= 1.0.1)", "%>%")
import::from(magrittr, "%>%") # no version, quotes are unnecessary.