一键导入
bench
R bench package for benchmarking. Use for high precision timing of R expressions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
R bench package for benchmarking. Use for high precision timing of R expressions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
R language data analysis and visualization skill. Use when user asks to (1) run R scripts or code, (2) install/update R packages, (3) perform data analysis with R, (4) create visualizations with ggplot2/plotly, (5) statistical analysis, (6) data manipulation with tidyverse/dplyr/data.table. Triggers on keywords like "R语言", "R脚本", "ggplot", "tidyverse", "数据分析", "可视化".
R DALEX package for model explanations. Use for explaining complex machine learning models.
R iml package for interpretable ML. Use for model-agnostic interpretability methods.
R lime package for local explanations. Use for explaining individual predictions with local interpretable models.
R packages for ML interpretability. Use for explaining and interpreting machine learning models.
R vip package for variable importance. Use for computing and visualizing variable importance scores.
| name | bench |
| description | R bench package for benchmarking. Use for high precision timing of R expressions. |
High precision timing of R expressions.
library(bench)
# Time single expression
bench::mark(
sqrt(1:1000)
)
# Compare expressions
bench::mark(
sqrt = sqrt(1:1000),
exp = exp(1:1000),
log = log(1:1000)
)
bench::mark(
sqrt(x),
exp(x),
iterations = 100, # Number of iterations
check = TRUE, # Check results are equal
memory = TRUE, # Track memory
time_unit = "ms" # Time unit
)
# Benchmark across parameters
results <- bench::press(
n = c(100, 1000, 10000),
{
x <- runif(n)
bench::mark(
sort(x),
order(x)
)
}
)
# Plot
autoplot(results)
results <- bench::mark(
sqrt(x),
exp(x)
)
# Access columns
results$expression
results$min
results$median
results$mem_alloc
results$n_itr
results$n_gc
results <- bench::mark(
method1 = { ... },
method2 = { ... },
memory = TRUE
)
# Memory allocated
results$mem_alloc
library(ggplot2)
# Autoplot
autoplot(results)
# Custom plot
ggplot(results, aes(x = expression, y = median)) +
geom_col()
# Measure system time
bench::system_time({
# Code to time
Sys.sleep(1)
})
# Force GC between iterations
bench::mark(
expr,
gc = TRUE
)
# Track GC
results$n_gc # Number of GC runs
# Compare relative to baseline
results <- bench::mark(
baseline = method1(),
improved = method2()
)
# Relative times
results$median / min(results$median)