Skip to content
Back to skills

Dbscan

ASecurity

R dbscan package for density-based clustering. Use for DBSCAN, OPTICS, and HDBSCAN clustering.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 4, 2026
datago

Security analysis

A100/100

Scanned June 4, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Dbscan?

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

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

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: dbscan
description: R dbscan package for density-based clustering. Use for DBSCAN, OPTICS, and HDBSCAN clustering.
---

# dbscan

Density-based clustering algorithms.

## DBSCAN

```r
library(dbscan)

# DBSCAN clustering
db <- dbscan(data, eps = 0.5, minPts = 5)

# Results
db$cluster  # 0 = noise
db$eps
db$minPts

# Plot
plot(data, col = db$cluster + 1L)
hullplot(data, db)
```

## Finding eps

```r
# k-nearest neighbor distances
kNNdist(data, k = 5)

# Plot to find elbow
kNNdistplot(data, k = 5)
abline(h = 0.5, col = "red")
```

## OPTICS

```r
# OPTICS ordering
opt <- optics(data, eps = 10, minPts = 5)

# Reachability plot
plot(opt)

# Extract clusters
db <- extractDBSCAN(opt, eps_cl = 0.5)
db <- extractXi(opt, xi = 0.05)

# Plot
hullplot(data, db)
```

## HDBSCAN

```r
# Hierarchical DBSCAN
hdb <- hdbscan(data, minPts = 5)

# Results
hdb$cluster
hdb$membership_prob
hdb$outlier_scores

# Plot
plot(hdb)
plot(hdb, show_flat = TRUE)
```

## LOF (Local Outlier Factor)

```r
# Compute LOF scores
lof_scores <- lof(data, minPts = 5)

# Higher scores = more outlier-like
plot(data, cex = lof_scores)
```

## k-NN

```r
# k-nearest neighbors
nn <- kNN(data, k = 5)

# Results
nn$id    # Neighbor indices
nn$dist  # Distances

# Shared nearest neighbors
snn <- sNN(data, k = 5)
```

## Framing

```r
# Points in eps-neighborhood
frNN(data, eps = 0.5)
```

## Predict

```r
# Predict cluster for new points
predict(db, newdata = new_data, data = data)
```

## With Large Data

```r
# Use index for speed
db <- dbscan(data, eps = 0.5, minPts = 5,
  search = "kdtree")  # or "linear", "dist"
```

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.