Skip to content
Back to skills

Rtsne

ASecurity

R Rtsne package for t-SNE. Use for t-distributed stochastic neighbor embedding visualization.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 4, 2026
data

Security analysis

A100/100

Scanned June 4, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Rtsne?

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

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

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: Rtsne
description: R Rtsne package for t-SNE. Use for t-distributed stochastic neighbor embedding visualization.
---

# Rtsne

t-Distributed Stochastic Neighbor Embedding.

## Basic Usage

```r
library(Rtsne)

# Run t-SNE
tsne <- Rtsne(data, dims = 2, perplexity = 30)

# Results
tsne$Y  # 2D coordinates

# Plot
plot(tsne$Y, col = labels, pch = 19)
```

## Parameters

```r
tsne <- Rtsne(data,
  dims = 2,           # Output dimensions
  perplexity = 30,    # Perplexity (5-50)
  theta = 0.5,        # Speed/accuracy trade-off (0 = exact)
  max_iter = 1000,    # Iterations
  eta = 200,          # Learning rate
  pca = TRUE,         # Initial PCA
  pca_center = TRUE,
  pca_scale = FALSE,
  verbose = TRUE
)
```

## Remove Duplicates

```r
# t-SNE requires unique rows
tsne <- Rtsne(unique(data), check_duplicates = FALSE)

# Or
tsne <- Rtsne(data, check_duplicates = TRUE)  # Default
```

## From Distance Matrix

```r
# Compute distances
d <- dist(data)

# t-SNE from distances
tsne <- Rtsne(as.matrix(d), is_distance = TRUE)
```

## Reproducibility

```r
# Set seed for reproducibility
set.seed(42)
tsne <- Rtsne(data)

# Or use seed parameter
tsne <- Rtsne(data, seed = 42)
```

## Perplexity Selection

```r
# Try different perplexities
perplexities <- c(5, 10, 30, 50)

par(mfrow = c(2, 2))
for (p in perplexities) {
  tsne <- Rtsne(data, perplexity = p)
  plot(tsne$Y, main = paste("Perplexity:", p))
}
```

## With ggplot2

```r
library(ggplot2)

tsne_df <- data.frame(
  x = tsne$Y[, 1],
  y = tsne$Y[, 2],
  label = labels
)

ggplot(tsne_df, aes(x, y, color = label)) +
  geom_point() +
  theme_minimal()
```

## Large Data

```r
# Use Barnes-Hut approximation
tsne <- Rtsne(data, theta = 0.5)  # Faster

# Exact t-SNE (slow)
tsne <- Rtsne(data, theta = 0)
```

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.