Skip to content
Back to skills

Qs

ASecurity

R qs package for quick serialization of R objects. Use for fast saving/loading of any R object with high compression.

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 4, 2026
datagoperformance

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill qs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Qs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Qs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-qs/badge)](https://www.skillsdirectory.com/skills/leolin990405-qs)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: qs
description: R qs package for quick serialization of R objects. Use for fast saving/loading of any R object with high compression.
---

# qs

Quick serialization of R objects.

## Basic Usage

```r
library(qs)

# Save any R object
qsave(obj, "data.qs")

# Load
obj <- qread("data.qs")
```

## Presets

```r
# Fast preset (speed priority)
qsave(obj, "data.qs", preset = "fast")

# High preset (compression priority)
qsave(obj, "data.qs", preset = "high")

# Balanced preset (default)
qsave(obj, "data.qs", preset = "balanced")

# Archive preset (maximum compression)
qsave(obj, "data.qs", preset = "archive")

# Uncompressed
qsave(obj, "data.qs", preset = "uncompressed")
```

## Custom Settings

```r
# Custom compression
qsave(obj, "data.qs",
  algorithm = "zstd",      # or "lz4", "zstd_stream", "lz4_stream"
  compress_level = 4,      # 1-22 for zstd, 1-12 for lz4
  nthreads = 4
)

# Shuffle for better compression of numeric data
qsave(obj, "data.qs", shuffle_control = 15)
```

## Supported Objects

```r
# qs supports virtually all R objects:
# - Data frames, tibbles, data.tables
# - Lists, environments
# - Matrices, arrays
# - Functions, formulas
# - S3, S4, R6 objects
# - Factors with levels
# - Attributes preserved

# Complex nested structures
complex_obj <- list(
  df = data.frame(x = 1:100),
  model = lm(y ~ x, data = df),
  func = function(x) x^2,
  env = new.env()
)
qsave(complex_obj, "complex.qs")
```

## Streaming

```r
# Save to connection
con <- file("data.qs", "wb")
qsave(obj, con)
close(con)

# Read from connection
con <- file("data.qs", "rb")
obj <- qread(con)
close(con)

# Save to raw vector
raw_data <- qserialize(obj)

# Load from raw vector
obj <- qdeserialize(raw_data)
```

## Performance

```r
# qs is typically:
# - 3-10x faster than saveRDS
# - Better compression than RDS
# - Supports multithreading

# Benchmark
library(microbenchmark)
microbenchmark(
  qs = qsave(df, "test.qs"),
  rds = saveRDS(df, "test.rds"),
  times = 10
)
```

## Thread Control

```r
# Set threads for save/load
qsave(obj, "data.qs", nthreads = 4)
obj <- qread("data.qs", nthreads = 4)

# Check available threads
qs::qread_threads()
```

## Strict Mode

```r
# Strict mode for reproducibility
qsave(obj, "data.qs", strict = TRUE)

# Validates object integrity on read
obj <- qread("data.qs", strict = TRUE)
```

## Hash Verification

```r
# Save with hash
qsave(obj, "data.qs", check_hash = TRUE)

# Verify on read
obj <- qread("data.qs", validate_checksum = TRUE)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.