T-Distributed Stochastic Neighbor Embedding using a Barnes-Hut Implementation

An R wrapper around the fast T-distributed Stochastic Neighbor Embedding implementation by Van der Maaten (see < https://github.com/lvdmaaten/bhtsne/> for more information on the original implementation).

CRANversion Travis-CI BuildStatus codecov.io CRAN mirrordownloads


To install from CRAN:

install.packages("Rtsne") # Install Rtsne package from CRAN

To install the latest version from the github repository, use:

if(!require(devtools)) install.packages("devtools") # If not already installed


After installing the package, use the following code to run a simple example (to install, see below).

library(Rtsne) # Load package
iris_unique <- unique(iris) # Remove duplicates
set.seed(42) # Sets seed for reproducibility
tsne_out <- Rtsne(as.matrix(iris_unique[,1:4])) # Run TSNE
plot(tsne_out$Y,col=iris_unique$Species,asp=1) # Plot the result


This R package offers a wrapper around the Barnes-Hut TSNE C++ implementation of [2] [3]. Changes were made to the original code to allow it to function as an R package and to add additional functionality and speed improvements.


[1] L.J.P. van der Maaten and G.E. Hinton. Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research 9(Nov):2579-2605, 2008.

[2] L.J.P. van der Maaten. Barnes-Hut-SNE. In Proceedings of the International Conference on Learning Representations, 2013.

[3] http://homepage.tudelft.nl/19j49/t-SNE.html


Rtsne 0.15

  • Substantial speed increase by fixing the possible embedding dimensionalities to 1, 2 or 3
  • Clarification of the licensing of different parts of the package
  • Support for using, more efficient, partial PCA (by Daniel Wells)
  • Made the normalization optional and the normalization function used available (by Aaron Lun)
  • Support for using precomputed nearest neighbour matrices (by Aaron Lun)
  • Added OpenMP support
  • Default verbose value is now the global setting (by Richard Cotton)
  • Added a NEWS.md file to track changes to the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.15 by Jesse Krijthe, 3 years ago


Browse source code at https://github.com/cran/Rtsne

Authors: Jesse Krijthe [aut, cre] , Laurens van der Maaten [cph] (Author of original C++ code)

Documentation:   PDF Manual  

file LICENSE license

Imports Rcpp, stats

Suggests irlba, testthat

Linking to Rcpp

Imported by AutoPipe, CINNA, EmbedSOM, FateID, HDclust, MOSS, Mercator, PAC, RaceID, SNPfiltR, Seurat, bcTSNE, conos, densityClust, fdm2id, greatR, iCellR, immunarch, labdsv, maotai, pagoda2, randomcoloR, rliger, scRNAtools, spathial, visvow.

Suggested by ProjectionBasedClustering, coRanking, diceR, dimRed, dyndimred, liminal, mmb, seriation, singleCellHaystack, stm, tinyarray.

See at CRAN