Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reimplementations of Functions Introduced Since R-3.0.0

NotificationsYou must be signed in to change notification settings

r-lib/backports

Repository files navigation

CRAN_Status_BadgeR-CMD-checkDownload Stats

This package provides backports of functions which have been introduced in one of the base packages in R version 3.0.1 or later.The backports are conditionally exported in order to let R resolve the function name to either the implemented backport, or the respective base version, if available.Package developers can make use of new functions or arguments by selectively importing specific backports to support older installations.

Usage

Interactively

Attach the namespace vialibrary(backports).

Note that it is crucial thatbackports is build against the currently running R version.Do not ignore these kind of warnings for this package.

In packages

  1. Add backports to your DESCRIPTION underImports.
  2. Add or modify the function.onLoad() (seehere) to call theimport() function of backports:
    .onLoad<-function(libname,pkgname) {backports::import(pkgname)}
    You can also selectively import functions:
    .onLoad<-function(libname,pkgname) {backports::import(pkgname, c("get0","dir.exists"))}
    If you setforce = TRUE, the provided functions will get imported, regardless of the R version:
    .onLoad<-function(libname,pkgname) {backports::import(pkgname,"hasName",force=TRUE)}
  3. [Optional] SetDepends in your DESCRIPTION to requireR (>= 3.0.0).

Importing backports fromutils ortools

Backports for functions which are not in thebase require additional steps.Usually, you need to to import those functions in the package NAMESPACE.However, this is only possible if such a function really exists, and yields a warning duringR CMD check for older versions.There are three possibilities to deal with this:

  1. Completely import the namespaces instead of selectively importing them, e.g. useimport(utils) instead ofimportFrom(utils, hasName) in yourNAMESPACE file.
  2. Force-import the function (see above) so that you always use the backport instead of the implementation shipped with R, even for the most recent version of R.
  3. Use a conditional import in yourNAMESPACE file, e.g.
    if (getRversion() >= "3.4.0") {  importFrom(utils, hasName)} else {  importFrom(backports, hasName)}

Note that the braces{} are necessary in theNAMESPACE file, even though they wouldn't be for regular R code, and that you might get a warningfor includingbackports in theImports: section of yourDESCRIPTION file if you never end up using it.

Backports for R versions prior to 3.2.0

  • base::anyNA()
  • base::dir.exists()
  • base::file.size(),base::file.mode() andbase::file.mtime()
  • base::lengths()
  • Argumentextra_cols forbase::file.info()
  • Argumentrepeated forutils::URLencode
  • base::isNamespaceLoaded()

Backports for R versions prior to 3.3.0

  • base::startsWith() andbase::endsWith()
  • base::strrep()
  • base::trimws()
  • Argumenttype forutils::capture.output()

Backports for R versions prior to 3.4.0

  • base::.valid.factor()
  • utils::hasName()

Backports for R versions prior to 3.5.0

  • base::...length()
  • base::...elt()
  • base::isFALSE()

Backports for R versions prior to 3.6.0

  • base::warningCondition()
  • base::errorCondition()
  • Argumentq forbase::dQuote() andbase::sQuote()
  • tools::vignetteInfo()
  • base::str2lang()
  • base::str2expression()
  • base::asplit()
  • utils::removeSource() with the capability to strip source from language objects.

Backports for R versions prior to 4.0.0

  • base::deparse1()
  • base::list2DF()
  • tools::R_user_dir()
  • Argumentclasses forbase::suppressWarnings() andbase::suppressMessages()

Backports for R versions prior to 4.0.1

  • Argumentrecycle0 forbase::paste().
  • Argumentrecycle0 forbase::paste0().

Backports for R versions prior to 4.1.0

  • base::...names()
  • base::.libPaths()

Backports for R versions prior to 4.3.0

  • tools:::print.Rconcordance
  • tools:::as.character.Rconcordance
  • tools::as.Rconcordance
  • tools:::as.Rconcordance.default
  • tools::matchConcordance

About

Reimplementations of Functions Introduced Since R-3.0.0

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp