Perplexity is too large I am trying to run {Rtsne}. On pca dataset prepared by using dudi.pca from {ade4}.

For pca calculation I selected 40 components while specifying parameters for dudi.pca:

pca = dudi.pca(counts(sce_normalized), scannf=FALSE, nf=40)


{Rtsne} gives me an error: “perplexity is too large”, how could it be fixed?

The code I am trying to run is below:

name_of_file &lt;- "dudi_pca.rds"
path_to_file &lt;- paste0("/scratch/nv4e/scRNA-
seq/normalization/new_datasets/",
                   name_of_file, sep="")
dudi_pca &lt;- readRDS(path_to_file)

# run Rtsne with default parameters
rtsne_out &lt;- Rtsne(as.matrix(dudi_pca), pca=FALSE)
I was using dudi_pca incorrectly. The supplied parameter to as.matrix() should have been dudi_pca$li:

rtsne_out &lt;- Rtsne(as.matrix(dudi_pca$li), pca=FALSE)