library(knitr) opts_chunk$set(echo = FALSE, comment = NA)
## Data dfr <- params$dfr vars <- params$vars rownames(dfr) <- dfr[, "INSTN"] dfr <- dfr[, vars] ## Determine variables with missing values lit <- map(dfr, anyNA) %>% unlist() lgc_lit <- lit %>% as.vector() lgc_val <- any(lgc_lit == TRUE) names_var <- names(lit[lgc_lit]) msg <- paste(names_var, collapse = ", ") %>% paste0("The following variables have missing values: ", .)
r if (lgc_val) {"There are missing values in some variables. For this reason, we could not perform a principal components analysis"}
cat(msg)
r if (!lgc_val) {"A principal components analysis is shown to see the associations among the genotypes and some attributes."}
princip <- prcomp(dfr, center = TRUE, scale = TRUE) summary(princip) print(princip$x) factoextra::fviz_pca(princip, repel = TRUE, title = "Biplot of genotypes and attributes")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.