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

R-devel has changed code#78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
dmurdoch wants to merge7 commits intor-lib:main
base:main
Choose a base branch
Loading
fromdmurdoch:concordances3
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
R-devel has made changes to concordance code
  • Loading branch information
@dmurdoch
dmurdoch committedMar 20, 2023
commitddf6bd65c1d173f93f49b87073ed6d2186a890ad
21 changes: 20 additions & 1 deletion.github/workflows/rcmdcheck.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,10 @@ jobs:
- {os: ubuntu-latest, r: '3.5'}
- {os: ubuntu-latest, r: '3.4'}
- {os: ubuntu-latest, r: '3.3'}
- {os: ubuntu-latest, r: '3.2'}
# The remotes package is not available before 3.2
# - {os: ubuntu-latest, r: '3.1'}
# - {os: ubuntu-latest, r: '3.0'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand All@@ -40,13 +44,28 @@ jobs:
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm:true
use-public-rspm:matrix.config.r > '3.3'

- name: Install in old versions
if: matrix.config.r <= '3.3'
run: |
install.packages("remotes")
remotes::install_local(".", dependencies = TRUE)
shell: Rscript {0}

- uses: r-lib/actions/setup-r-dependencies@v2
if: matrix.config.r > '3.3'
with:
extra-packages: any::rcmdcheck
needs: check

- name: Check in old versions
if: matrix.config.r <= '3.3'
run: |
R CMD build .
R CMD check --no-manual *.tar.gz

- uses: r-lib/actions/check-r-package@v2
if: matrix.config.r > '3.3'
with:
upload-snapshots: true
1 change: 1 addition & 0 deletionsNAMESPACE
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,6 +45,7 @@ if (getRversion() < "4.3.0") S3method("as.character", "Rconcordance")
if (getRversion() < "4.3.0") S3method("print", "Rconcordance")
if (getRversion() < "4.3.0") export(as.Rconcordance)
if (getRversion() < "4.3.0") export(matchConcordance)
if (getRversion() < "4.1.0") export(.libPaths)
importFrom(utils,getFromNamespace)
importFrom(utils,head)
useDynLib(backports,dotsElt)
Expand Down
2 changes: 1 addition & 1 deletionR/Rconcordance.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -203,7 +203,7 @@ addConcordance <- function(conc, s) {
#' See the original description in \code{tools::followConcordance}.
#'
#' @keywords internal
#' @rawNamespace if (getRversion() < "4.3.0")S3method("print", "Rconcordance")
#' @rawNamespace if (getRversion() < "4.3.0")export(followConcordance))

followConcordance <- function(concordance, prevConcordance) {
if (!is.null(prevConcordance)) {
Expand Down
10 changes: 5 additions & 5 deletionsR/import.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,14 +63,14 @@ get_backports = function(v = getRversion()) {

FUNS = list(
"4.3.0" = c("as.Rconcordance", "matchConcordance"),
"4.1.0" = c("...names"),
"4.1.0" = c("...names", ".libPaths"),
"4.0.1" = c("paste", "paste0"),
"4.0.0" = c("R_user_dir", "deparse1", "list2DF", "suppressWarnings", "suppressMessages", "stopifnot"),
"3.6.0" = c("warningCondition", "errorCondition", "vignetteInfo", "dQuote", "sQuote", "removeSource", "asplit"),
"3.6.0" = c("warningCondition", "errorCondition", "vignetteInfo", "dQuote", "sQuote", "removeSource", "asplit", "str2lang", "str2expression"),
"3.5.0" = c("...length", "...elt", "isFALSE", "isTRUE"),
"3.4.0" = c("hasName"),
"3.3.0" = c("startsWith", "endsWith", "strrep", "trimws", "capture.output"),
"3.2.0" = c("anyNA", "dir.exists", "file.size", "file.mode", "file.mtime", "lengths", "file.info", "URLencode", "isNamespaceLoaded"),
"3.4.0" = c("hasName", ".valid.factor"),
"3.3.0" = c("startsWith", "endsWith", "strrep", "capture.output"),
"3.2.0" = c("anyNA", "dir.exists", "file.size", "file.mode", "file.mtime", "lengths", "file.info", "URLencode", "isNamespaceLoaded", "trimws"),
"3.1.0" = character(),
"3.0.0" = character(),
"0.0.0" = character()
Expand Down
41 changes: 41 additions & 0 deletionsR/libPaths.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
#' @title Backport of .libPaths for R < 4.1.0
#' @rdname libPaths
#'
#' @description
#' See the original description in \code{base::.libPaths}.
#'
#' @keywords internal
#' @rawNamespace if (getRversion() < "4.1.0") export(.libPaths)
#' @examples
#' save <- .libPaths()
#' save
#' # ignore the site library
#' .libPaths("test", include.site = FALSE)
#'
#' # restore the original
#' .libPaths(save)

.libPaths <- local({
.lib.loc <- character() # This won't be used; see below
function(new, include.site = TRUE) {
if(!missing(new)) {
## paths don't really need to be unique, but searching
## large library trees repeatedly would be inefficient.
## Use normalizePath for display
new <- Sys.glob(path.expand(new))
paths <- c(new, if(include.site) .Library.site, .Library)
paths <- paths[dir.exists(paths)]
.lib.loc <<- unique(normalizePath(paths, "/"))
}
else
.lib.loc
}})

# Run this in .onLoad:

# environment(.libPaths) <- environment(base::.libPaths)

# This will make our function see and modify the base
# function's copy of .lib.loc. This relies on the
# implementation in base, which has been the
# same since R 1.6.0 or earlier.
1 change: 1 addition & 0 deletionsR/zzz.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,4 +3,5 @@

.onUnload = function (libpath) {
library.dynam.unload("backports", libpath)
environment(.libPaths) <- environment(base::.libPaths)
}
1 change: 1 addition & 0 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,7 @@ for including `backports` in the `Imports:` section of your `DESCRIPTION` file i

## 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`
Expand Down
21 changes: 21 additions & 0 deletionsman/libPaths.Rd
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

18 changes: 18 additions & 0 deletionstests/test_dotlibPaths.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
source("helper/helper.R")

f = get(".libPaths", envir = baseenv())
expect_same = makeCompareFun(f, backports:::.libPaths)

save <- .libPaths()

f <- tempfile()
expect_same(f)
dir.create(f)
expect_same(f)
if (getRversion() >= "4.1.0") {
expect_same(f, include.site = FALSE)
} else {
.libPaths(f, include.site = FALSE)
expect_same()
}
.libPaths(save, include.site = length(.Library.site) && .Library.site %in% save)

[8]ページ先頭

©2009-2025 Movatter.jp