Skip to content

Commit

Permalink
Activate commas_linter (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Feb 2, 2025
1 parent 705f455 commit 81b51fa
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 277 deletions.
1 change: 0 additions & 1 deletion .lintr.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ linters = all_linters(
par = NULL
)),
assignment_linter = NULL,
commas_linter = NULL,
commented_code_linter = NULL,
condition_call_linter = NULL,
cyclocomp_linter = NULL,
Expand Down
6 changes: 3 additions & 3 deletions R/cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
#' @examples
#' x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE))
#' y <- x
#' bit::still.identical(x,y)
#' bit::still.identical(x, y)
#' y[1] <- NA
#' bit::still.identical(x,y)
#' bit::still.identical(x, y)
#' mycache <- newcache(x)
#' ls(mycache)
#' mycache
Expand All @@ -67,7 +67,7 @@ newcache <- function(x) {
vmode <- typeof(x)
if (vmode=="double" && is.integer64(x))
vmode <- "integer64"
setattr(env, "class", c(paste("cache", vmode, sep="_"),"cache","environment"))
setattr(env, "class", c(paste("cache", vmode, sep="_"), "cache", "environment"))
assign("x", x, envir=env)
env
}
Expand Down
14 changes: 7 additions & 7 deletions R/hash64.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
#' hashtab(hy)
#' hashmaptab(y)
#'
#' stopifnot(identical(match(as.integer(x),as.integer(y)),hashpos(hy, x)))
#' stopifnot(identical(match(as.integer(x),as.integer(y)),hashrev(hx, y)))
#' stopifnot(identical(match(as.integer(x), as.integer(y)), hashpos(hy, x)))
#' stopifnot(identical(match(as.integer(x), as.integer(y)), hashrev(hx, y)))
#' stopifnot(identical(as.integer(x) %in% as.integer(y), hashfin(hy, x)))
#' stopifnot(identical(as.integer(x) %in% as.integer(y), hashrin(hx, y)))
#' stopifnot(identical(duplicated(as.integer(y)), hashdup(hy)))
Expand All @@ -95,12 +95,12 @@
#' message("i.e. more data means less random access and more collisions")
#' bits <- 24
#' b <- seq(-1, 0, 0.1)
#' tim <- matrix(NA, length(b), 2, dimnames=list(b, c("bits","bits+1")))
#' tim <- matrix(NA, length(b), 2, dimnames=list(b, c("bits", "bits+1")))
#' for (i in 1:length(b)) {
#' n <- as.integer(2^(bits+b[i]))
#' x <- as.integer64(sample(n))
#' tim[i,1] <- repeat.time(hashmap(x, hashbits=bits))[3]
#' tim[i,2] <- repeat.time(hashmap(x, hashbits=bits+1))[3]
#' tim[i, 1] <- repeat.time(hashmap(x, hashbits=bits))[3]
#' tim[i, 2] <- repeat.time(hashmap(x, hashbits=bits+1))[3]
#' print(tim)
#' matplot(b, tim)
#' }
Expand Down Expand Up @@ -275,7 +275,7 @@ hashtab.cache_integer64 <- function(cache, ...) {
hashdat <- get("x", envir=cache, inherits=FALSE)
nunique <- get("nunique", envir=cache, inherits=FALSE)
ret <- .Call(C_hashtab_integer64, hashdat, hashbits, hashmap, nunique)
attr(ret, "names") <- c("values","counts")
attr(ret, "names") <- c("values", "counts")
ret
}

Expand All @@ -300,7 +300,7 @@ hashmaptab.integer64 <- function(x, nunique=NULL, minfac=1.5, hashbits=NULL, ...
hashmap <- integer(nhash)
ret <- .Call(C_hashmaptab_integer64, x, hashbits, hashmap, nunique)
# theoretically we could use {hashmap, nunique} at this point the same way like after calling hashmap_integer64
attr(ret, "names") <- c("values","counts")
attr(ret, "names") <- c("values", "counts")
ret
}

Expand Down
Loading

0 comments on commit 81b51fa

Please sign in to comment.