plot_pca.Rd
Plots either the first 2 or 3 principal components, with the data points labelled accordng to chosen meta data in the mip data set.
plot_pca(pca, num_components = 2, meta_var = "Country")
pca | output of |
---|---|
num_components | numeric for number of components used. Default = 2 |
meta_var | character for the desired meta variable to be used for labelling the scatterplot. Default = "Country". |
Using the output of pca_mip_data
and a specified variable
within the mip data set, e.g the country of sample collection, a
scatterplot of the data is produced. Either the first 2 or 3 components
can be used, as specified with `num_components`. The chosen `meta_var`
must be a variable found within the mip data set (this is included as
the last element in the object returned by pca_mip_data
).
dat <- dummy_data() dat <- filter_misc(dat = dat) dat <- filter_coverage(dat = dat, min_coverage = 2) dat <- melt_mip_data(dat = dat) dat <- impute_mip_data(dat = dat) pca <- pca_mip_data(dat = dat) plot_pca(pca, num_components = 2, meta_var = "Country") plot_pca(pca, num_components = 3, meta_var = "Study")