<p>I was using <code>dudi_pca</code> incorrectly. The supplied parameter to <code>as.matrix()</code> should have been <code>dudi_pca$li</code>:</p>

<pre><code>rtsne_out &lt;- Rtsne(as.matrix(dudi_pca$li), pca=FALSE)
</code></pre>

CC BY-SA 3.0
2018-01-22T18:29:40.477Z
2018-01-22T18:29:40.477Z
Nikita Vlasenko
<p>I am trying to run <a href="https://cran.r-project.org/web/packages/Rtsne/Rtsne.pdf" rel="nofollow noreferrer">{Rtsne}</a>. On <code>pca</code> dataset prepared by using <code>dudi.pca</code> from <a href="https://pbil.univ-lyon1.fr/ade4/ade4-html/dudi.pca.html" rel="nofollow noreferrer">{ade4}</a>.</p>

<p>For pca calculation I selected 40 components while specifying parameters for <code>dudi.pca</code>:</p>

<pre><code>pca = dudi.pca(counts(sce_normalized), scannf=FALSE, nf=40)
</code></pre>

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

<p>The code I am trying to run is below:</p>

<pre><code>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)
</code></pre>

CC BY-SA 3.0
2018-01-21T22:45:28.800Z
What are the dimensions of `dudi_pca`?
Devon Ryan
CC BY-SA 3.0
2018-01-22T18:30:05.750Z
The dimensions are `20 000 x 40`
Nikita Vlasenko
<r><pca>
Perplexity is too large
# Perplexity is too large

(Asked by: username_0 on 2018-01-21)

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 <- "dudi_pca.rds"
path_to_file <- paste0("/scratch/nv4e/scRNA-
seq/normalization/new_datasets/",
                   name_of_file, sep="")
dudi_pca <- readRDS(path_to_file)

# run Rtsne with default parameters
rtsne_out <- Rtsne(as.matrix(dudi_pca), pca=FALSE)

**Tags:** r, pca
> **Comments:**
> **username_1**: What are the dimensions of `dudi_pca`?  
> **username_0**: The dimensions are `20 000 x 40`  

---

## 1 answers

### Answer by username_0 on 2018-01-22. Score: 2 | Accepted answer

I was using dudi_pca incorrectly. The supplied parameter to as.matrix() should have been dudi_pca$li:
rtsne_out <- Rtsne(as.matrix(dudi_pca$li), pca=FALSE)


---

