Skip to content
Snippets Groups Projects
Verified Commit 95129a51 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

reveal some figures in practicals with echo=F

parent 1b814878
No related branches found
No related tags found
No related merge requests found
...@@ -437,7 +437,7 @@ To obtain the following figure you will need to write the body of the `point_pro ...@@ -437,7 +437,7 @@ To obtain the following figure you will need to write the body of the `point_pro
Then you will need to compute the `slope` value for the `geom_abline` function from the `diy_cov` results. Then you will need to compute the `slope` value for the `geom_abline` function from the `diy_cov` results.
</div> </div>
```{r include=FALSE, echo=T} ```{r echo=F}
point_projection <- function(diy_cov, x, y){ point_projection <- function(diy_cov, x, y){
a <- c(x, y) a <- c(x, y)
b <- eigen(diy_cov)$vector[, 1] b <- eigen(diy_cov)$vector[, 1]
...@@ -544,7 +544,7 @@ We are now going to plot the second principal component and the projection of th ...@@ -544,7 +544,7 @@ We are now going to plot the second principal component and the projection of th
Adapt your previous code to perform the computation on the PC2 Adapt your previous code to perform the computation on the PC2
</div> </div>
```{r include=FALSE, echo=T} ```{r echo=F}
point_projection <- function(diy_cov, x, y){ point_projection <- function(diy_cov, x, y){
a <- c(x, y) a <- c(x, y)
b <- eigen(diy_cov)$vector[, 2] b <- eigen(diy_cov)$vector[, 2]
...@@ -654,7 +654,7 @@ For 3 variables ? ...@@ -654,7 +654,7 @@ For 3 variables ?
You can merge your previous computation to plot the projection on the 2 first PCs You can merge your previous computation to plot the projection on the 2 first PCs
</div> </div>
```{r include=FALSE, echo=T} ```{r echo=F}
point_projection <- function(diy_cov, x, y, PC){ point_projection <- function(diy_cov, x, y, PC){
a <- c(x, y) a <- c(x, y)
b <- eigen(diy_cov)$vector[, PC] b <- eigen(diy_cov)$vector[, PC]
...@@ -894,7 +894,7 @@ pc_var / sum(pc_var) ...@@ -894,7 +894,7 @@ pc_var / sum(pc_var)
The `fviz_eig` function create a scree plot of your PCA. The `fviz_eig` function create a scree plot of your PCA.
```{r include=FALSE, echo=T} ```{r echo=F}
fviz_eig(data_f_pca) fviz_eig(data_f_pca)
``` ```
...@@ -934,7 +934,7 @@ It means that if `bill_depth_mm` contribute for 1 to PC1, `bill_length_mm` contr ...@@ -934,7 +934,7 @@ It means that if `bill_depth_mm` contribute for 1 to PC1, `bill_length_mm` contr
As the number of variables increases, so is the complexity of the linear combinations for each PC. As the number of variables increases, so is the complexity of the linear combinations for each PC.
We can represent the variable axis in the new PCA axis, this representation is called the correlation circle. We can represent the variable axis in the new PCA axis, this representation is called the correlation circle.
```{r, include=F, echo=T} ```{r, echo=F}
fviz_pca_var(data_f_pca, col.var = "contrib") fviz_pca_var(data_f_pca, col.var = "contrib")
``` ```
...@@ -949,7 +949,7 @@ Use the `str()` function to find this information in the `data_f_pca` object ...@@ -949,7 +949,7 @@ Use the `str()` function to find this information in the `data_f_pca` object
Finally, we can use the `fviz_pca_biplot` function to display the individuals and variable information on the same plot. Finally, we can use the `fviz_pca_biplot` function to display the individuals and variable information on the same plot.
```{r, include=F, echo=T} ```{r, echo=F}
fviz_pca_biplot( fviz_pca_biplot(
data_f_pca, geom = "point", data_f_pca, geom = "point",
col.ind = (data %>% filter(sex == "female") %>% pull(species)), col.ind = (data %>% filter(sex == "female") %>% pull(species)),
......
...@@ -214,7 +214,7 @@ data_pca <- data[var_gene_2000[1:600], ] %>% ...@@ -214,7 +214,7 @@ data_pca <- data[var_gene_2000[1:600], ] %>%
</p> </p>
</details> </details>
```{r, include=F, echo=T} ```{r, echo=F}
data_pca %>% data_pca %>%
fviz_pca_ind( fviz_pca_ind(
geom = "point", geom = "point",
...@@ -384,7 +384,7 @@ Why is the `centers` parameter required for `kmeans()` and not for the `hclust() ...@@ -384,7 +384,7 @@ Why is the `centers` parameter required for `kmeans()` and not for the `hclust()
We want to compare the cells annotation to our clustering. We want to compare the cells annotation to our clustering.
```{r, include=F, echo=T} ```{r, echo=F}
data_pca %>% data_pca %>%
fviz_pca_ind( fviz_pca_ind(
geom = "point", geom = "point",
...@@ -396,7 +396,7 @@ data_pca %>% ...@@ -396,7 +396,7 @@ data_pca %>%
Using the `str()` function make the following plot from your k-means results. Using the `str()` function make the following plot from your k-means results.
</div> </div>
```{r, include=F, echo = T} ```{r, echo = F}
data_pca %>% data_pca %>%
fviz_pca_ind( fviz_pca_ind(
geom = "point", geom = "point",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment