On Wed, Dec 16, 2020 at 8:39 PM Henrik Bengtsson
wrote:
>
> BTW, 'backports' provides a backport for tools::R_user_dir() also for
> R (< 4.0.0), so an alternative solution in this case is:
>
> Imports: backports
>
> and
>
> importFrom(backports, R_user_dir)
>
> The 'backports' package takes the sa
BTW, 'backports' provides a backport for tools::R_user_dir() also for
R (< 4.0.0), so an alternative solution in this case is:
Imports: backports
and
importFrom(backports, R_user_dir)
The 'backports' package takes the same approach as I did in my previous message.
Henrik
On Wed, Dec 16, 2020
Colin, you can do:
Imports: tools
NAMESPACE:
if (getRversion() >= 4) importFrom(tools,R_user_dir)
R/000.namespace.R:
## Create a dummy R_user_dir() for R (< 4.0.0)
## to please R CMD check
if (getRversion() < 4) {
R_user_dir <- function(...) NULL
}
and then use:
if (getRversion() < 4) {
#
For "obvious" reasons? I don't see this kind of avoidance as "obviously"
correct at all. You have a dependency... it should be declared. There are
various ways to proceed, with Imports or Depends or Suggests or pulling the
code into your package... but trying to subvert the dependency management
Am 16.12.20 um 18:00 schrieb Neal Fultz:
> IIRC some packages use get() instead of double-colon to suppress the NOTE.
I'd discourage from using get() because you could (accidentally) access
even unexported objects from another namespace. There is
getExportedValue(ns, name)
to avoid that. However
IIRC some packages use get() instead of double-colon to suppress the NOTE.
I would probably ignore it myself.
On Wed, Dec 16, 2020 at 8:29 AM Colin Gillespie 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 d
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