Skip to content

Commit d7df62c

Browse files
authored
Merge branch 'master' into redundantParameterCleanup
2 parents c3f2147 + c446f2e commit d7df62c

33 files changed

+272
-242
lines changed

.ci/linters/rd/backtick_linter.R

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ensure no markdown-style backticks wind up in Rd where \code is intended
2+
options_documentation_linter = function(rd_file) {
3+
rd = tools::parse_Rd(rd_file)
4+
5+
error_if_backtick = function(rd_obj) {
6+
if (!is.recursive(rd_obj)) {
7+
if (any(grepl("`", rd_obj, fixed=TRUE))) {
8+
stop(sprintf(
9+
"Rd is not markdown -- backticks (`) don't render as code! Use \\code{...}.\nObserved in string '%s' in file %s",
10+
trimws(rd_obj), rd_file
11+
))
12+
}
13+
return(invisible())
14+
}
15+
tags = vapply(rd_obj, \(x) attr(x, "Rd_tag") %||% "", FUN.VALUE="")
16+
# backtick is valid inside R code (e.g. \examples, \code, \preformatted)
17+
rd_obj = rd_obj[!tags %in% c("RCODE", "VERB")]
18+
lapply(rd_obj, error_if_backtick)
19+
}
20+
21+
invisible(error_if_backtick(rd))
22+
}
File renamed without changes.

.dev/CRAN_Release.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ ls -1 *.tar.gz | grep -E 'Chicago|dada2|flowWorkspace|LymphoSeq' | TZ='UTC' para
562562
# 3) dllVersion() at the end of init.c
563563
# DO NOT push to GitHub's master branch. Prevents even a slim possibility of user getting premature version.
564564
# Even release numbers must have been obtained from CRAN and only CRAN. There were too many support problems in the past before this procedure was brought in.
565-
du -k inst/tests # 1.5MB before
565+
du -k inst/tests # 1.5MiB before
566566
bzip2 inst/tests/*.Rraw # compress *.Rraw just for release to CRAN; do not commit compressed *.Rraw to git
567-
du -k inst/tests # 0.75MB after
567+
du -k inst/tests # 0.75MiB after
568568
R CMD build .
569569
export GITHUB_PAT="f1c.. github personal access token ..7ad"
570570
Rdevel -q -e "packageVersion('xml2')" # ensure installed

.dev/revdep.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ options(repos = BiocManager::repositories())
6767

6868
options(warn=1) # warning at the time so we can more easily see what's going on package by package when we scroll through output
6969
cat("options()$timeout==", options()$timeout," set by R_DEFAULT_INTERNET_TIMEOUT in .dev/.bash_aliases revdepsh\n",sep="")
70-
# R's default is 60. Before Dec 2020, we used 300 but that wasn't enough to download Bioc package BSgenome.Hsapiens.UCSC.hg19 (677GB) which is
70+
# R's default is 60. Before Dec 2020, we used 300 but that wasn't enough to download Bioc package BSgenome.Hsapiens.UCSC.hg19 (677MiB) which is
7171
# suggested by CRAN package CNVScope which imports data.table. From Dec 2020 we use 3600.
7272

7373
if (is.null(utils::old.packages(.libPaths()[2]))) {

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ test-lin-rel-cran:
151151
_R_CHECK_CRAN_INCOMING_: "TRUE" ## stricter --as-cran checks should run in dev pipelines continuously (not sure what they are though)
152152
_R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE" ## Other than no URL checking (takes many minutes) or 'Days since last update 0' NOTEs needed, #3284
153153
_R_CHECK_CRAN_INCOMING_TARBALL_THRESHOLD_: "7500000" ## bytes
154-
_R_CHECK_PKG_SIZES_THRESHOLD_: "10" ## MB 'checking installed package size' NOTE increased due to po
154+
_R_CHECK_PKG_SIZES_THRESHOLD_: "10" ## MiB 'checking installed package size' NOTE increased due to po
155155
script:
156156
- *install-deps
157157
- echo 'CFLAGS=-g -O2 -fopenmp -Wall -pedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2' > ~/.R/Makevars

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
8383
19. Spurious warnings from internal code in `cube()`, `rollup()`, and `groupingsets()` are no longer surfaced to the caller, [#6964](https://github.com/Rdatatable/data.table/issues/6964). Thanks @ferenci-tamas for the report and @venom1204 for the fix.
8484
85+
20. `droplevels()` works on 0-row data.tables, [#7043](https://github.com/Rdatatable/data.table/issues/7043). The result will have factor columns `factor(character())`, consistent with the data.frame method. Thanks @advieser for the report and @MichaelChirico for the fix.
86+
8587
### NOTES
8688
8789
1. Continued work to remove non-API C functions, [#6180](https://github.com/Rdatatable/data.table/issues/6180). Thanks Ivan Krylov for the PRs and for writing a clear and concise guide about the R API: https://aitap.codeberg.page/R-api/.

R/data.table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ tail.data.table = function(x, n=6L, ...) {
22372237

22382238
"[<-.data.table" = function(x, i, j, value) {
22392239
# [<- is provided for consistency, but := is preferred as it allows by group and by reference to subsets of columns
2240-
# with no copy of the (very large, say 10GB) columns at all. := is like an UPDATE in SQL and we like and want two symbols to change.
2240+
# with no copy of the (very large, say 10GiB) columns at all. := is like an UPDATE in SQL and we like and want two symbols to change.
22412241
if (!cedta()) {
22422242
x = if (nargs()<4L) `[<-.data.frame`(x, i, value=value)
22432243
else `[<-.data.frame`(x, i, j, value)

R/duplicated.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ unique.data.table = function(x, incomparables=FALSE, fromLast=FALSE, by=seq_alon
4949

5050
# Test for #2013 unique() memory efficiency improvement in v1.10.5
5151
# set.seed(1)
52-
# Create unique 7.6GB DT on 16GB laptop
52+
# Create unique 7.6GiB DT on 16GiB laptop
5353
# DT = data.table(
5454
# A = sample(1e8, 2e8, TRUE),
5555
# B = sample(1e8, 2e8, TRUE),

R/fdroplevels.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 647 fast droplevels.data.table method
22
fdroplevels = function(x, exclude = if (anyNA(levels(x))) NULL else NA, ...) {
33
stopifnot(inherits(x, "factor"))
4+
if (!length(x)) return(structure(integer(), class='factor', levels=character())) # skip factor() overhead
45
lev = which(tabulate(x, nlevels(x)) & (!match(levels(x), exclude, 0L)))
56
ans = match(as.integer(x), lev)
67
setattr(ans, 'levels', levels(x)[lev])
@@ -15,7 +16,6 @@ droplevels.data.table = function(x, except=NULL, exclude, ...){
1516
}
1617

1718
setdroplevels = function(x, except=NULL, exclude=NULL) {
18-
if (!nrow(x)) return(invisible(x))
1919
ix = vapply_1b(x, is.factor)
2020
if (!is.null(except)) {
2121
stopifnot(is.numeric(except), except >= 1L, except <= length(x))

R/test.data.table.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
277277
y = head(order(-diff(timings$RSS)), 10L)
278278
ans = timings[, diff := c(NA_real_, round(diff(RSS), 1L))][y + 1L]
279279
ans[, time:=NULL] # time is distracting and influenced by gc() calls; just focus on RAM usage here
280-
catf("10 largest RAM increases (MB); see plot for cumulative effect (if any)\n")
280+
catf("10 largest RAM increases (MiB); see plot for cumulative effect (if any)\n")
281281
print(ans, class=FALSE)
282282
get("dev.new")(width=14.0, height=7.0)
283283
get("par")(mfrow=1:2)
284-
get("plot")(timings$RSS, main=paste(basename(fn),"\nylim[0]=0 for context"), ylab="RSS (MB)", ylim=c(0.0, max(timings$RSS)))
284+
get("plot")(timings$RSS, main=paste(basename(fn),"\nylim[0]=0 for context"), ylab="RSS (MiB)", ylim=c(0.0, max(timings$RSS)))
285285
get("mtext")(lastRSS<-as.integer(ceiling(last(timings$RSS))), side=4L, at=lastRSS, las=1L, font=2L)
286-
get("plot")(timings$RSS, main=paste(basename(fn),"\nylim=range for inspection"), ylab="RSS (MB)")
286+
get("plot")(timings$RSS, main=paste(basename(fn),"\nylim=range for inspection"), ylab="RSS (MiB)")
287287
get("mtext")(lastRSS, side=4L, at=lastRSS, las=1L, font=2L)
288288
}
289289

@@ -316,7 +316,7 @@ INT = function(...) { as.integer(c(...)) } # utility used in tests.Rraw
316316

317317
gc_mem = function() {
318318
# nocov start
319-
# gc reports memory in MB
319+
# gc reports memory in MiB
320320
m = colSums(gc()[, c(2L, 4L, 6L)])
321321
names(m) = c("GC_used", "GC_gc_trigger", "GC_max_used")
322322
m

0 commit comments

Comments
 (0)