[R-pkg-devel] Accessing features in R4.0.
brodie gaslam
brod|e@g@@|@m @end|ng |rom y@hoo@com
Wed Dec 16 17:39:20 CET 2020
I don't know if this will work in your case (or even if it is a good
or bad thing to do), but backports conditionally exports the function
in question, e.g.:
https://github.com/r-lib/backports/blob/master/R/lengths.R
So in that example their implementation of a function not available
in R < 3.2.0 is presumably only exported for those versions of R.
You could try something similar, although I make no guarantees
on whether this is considered proper or not. It _seems_ like
a clean solution to me, but I have no experience putting any
logic in the namespace file.
WRE does show something very similar, so this might be okay:
https://cran.r-project.org/doc/manuals/R-exts.html#Registering-S3-methods
Best,
B.
On Wednesday, December 16, 2020, 11:29:08 AM EST, Colin Gillespie <csgillespie using gmail.com> wrote:
Hi,
I'm planning on using the tools::R_user_dir function in a package. But
for obvious reasons, I don't want to set the dependency on R 4.
My code is basically
if (as.numeric(R.version$major) < 4) # do something
else tools::R_user_dir("oysteR", which = "cache")
When checking on win-builder R3.6 I get the note
* checking dependencies in R code ... NOTE
Missing or unexported object: 'tools::R_user_dir'
## Question
Is my code correct and can I ignore this note?
Thanks
Colin
Dr Colin Gillespie
http://www.mas.ncl.ac.uk/~ncsg3/
______________________________________________
R-package-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list