explore_space_pca: Plot the PCA projection of the projection bases space

View source: R/explore_space.R

explore_space_pcaR Documentation

Plot the PCA projection of the projection bases space

Description

The set of functions returns a primary ggplot object that plots the data object in a space reduced by PCA. compute_pca() computes the PCA and explore_space_pca() plots the bases in the PCA-projected space

Usage

explore_space_pca(
  dt,
  details = FALSE,
  pca = TRUE,
  group = NULL,
  color = NULL,
  ...,
  animate = FALSE
)

flip_sign(dt, group = NULL, ...)

compute_pca(dt, group = NULL, random = TRUE, flip = TRUE, ...)

Arguments

dt

a data object collected by the projection pursuit guided tour optimisation in tourr

details

logical; if components other than start, end and interpolation need to be shown

pca

logical; if PCA coordinates need to be computed for the data

group

the variable to label different runs of the optimiser(s)

color

the variable to be coloured by

...

other arguments received from explore_space_pca()

animate

logical; if the interpolation path needs to be animated

random

logical; if random bases from the basis space need to be added to the data

flip

logical; if the sign flipping need to be performed

Value

explore_space_pca()

a ggplot object for diagnosing the optimisers in the PCA-projected basis space

flip_sign()

a list containing

  • a matrix of all the bases

  • a logical value whether a flip of sign is performed

  • a dataframe of the original dataset

compute_pca()

a list containing

  • the PCA summary

  • a dataframe with PC coordinates augmented

See Also

Other main plot functions: explore_space_tour(), explore_trace_interp(), explore_trace_search()

Examples

dplyr::bind_rows(holes_1d_geo, holes_1d_better) %>%
  bind_theoretical(matrix(c(0, 1, 0, 0, 0), nrow = 5),
    index = tourr::holes(), raw_data = boa5
  ) %>%
  explore_space_pca(group = method, details = TRUE) +
  scale_color_discrete_botanical()
dplyr::bind_rows(holes_1d_geo, holes_1d_better) %>%
  flip_sign(group = method) %>%
  str(max = 1)
dplyr::bind_rows(holes_1d_geo, holes_1d_better) %>% compute_pca(group = method)

ferrn documentation built on Aug. 6, 2022, 5:08 p.m.