Introduction
thisutils provides reliable building blocks for research workflows: sparse-matrix conversion and top-k selection, correlations, neighborhoods and LISI scores, repeated execution with structured messages, and optional dependency checks — with explicit semantics and bounded resource use.
Installation
Install CRAN version:
install.packages("thisutils")
# or
if (!require("pak", quietly = TRUE)) {
install.packages("pak")
}
pak::pak("thisutils")Install development version from GitHub use pak:
if (!require("pak", quietly = TRUE)) {
install.packages("pak")
}
pak::pak("mengxu98/thisutils")Quick start
library(Matrix)
library(thisutils)
x <- Matrix(
c(-3, 0, 2, -1, 4, 0),
nrow = 3,
sparse = TRUE,
dimnames = list(paste0("r", 1:3), paste0("c", 1:2))
)
# Implicit zeros for ordinary matrices; stored entries only for graphs
run_sparse_topk(x, k = 2, by = "col")
run_sparse_topk_stored(x, k = 2, by = "col")
# Blockwise correlation with a bounded dense working block
sparse_cor(simulate_sparse_matrix(200, 50), threshold = 0.2, block_size = 64)
# Repeat tasks with aligned serial/parallel results and per-input seeds
parallelize_fun(
list(first = x, second = x),
function(mat) thisutils::sparse_cor(mat, threshold = 0.2, block_size = 64),
cores = 2,
backend = "psock",
seed = 2026
)See the function reference for the complete API, and run vignette("research-package-workflows", package = "thisutils") for a connected example installed with the package.