tm_a_pca {teal.modules.general} | R Documentation |
teal
module: Principal component analysis
Description
Module conducts principal component analysis (PCA) on a given dataset and offers different ways of visualizing the outcomes, including elbow plot, circle plot, biplot, and eigenvector plot. Additionally, it enables dynamic customization of plot aesthetics, such as opacity, size, and font size, through UI inputs.
Usage
tm_a_pca(
label = "Principal Component Analysis",
dat,
plot_height = c(600, 200, 2000),
plot_width = NULL,
ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
ggplot2_args = teal.widgets::ggplot2_args(),
rotate_xaxis_labels = FALSE,
font_size = c(12, 8, 20),
alpha = c(1, 0, 1),
size = c(2, 1, 8),
pre_output = NULL,
post_output = NULL
)
Arguments
label |
( |
dat |
( |
plot_height |
( |
plot_width |
( |
ggtheme |
( |
ggplot2_args |
( List names should match the following: For more details see the vignette: |
rotate_xaxis_labels |
( |
font_size |
(
|
alpha |
(
|
size |
(
|
pre_output |
( |
post_output |
( |
Value
Object of class teal_module
to be used in teal
applications.
Examples
library(teal.widgets)
# general data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
USArrests <- USArrests
})
datanames(data) <- "USArrests"
app <- init(
data = data,
modules = modules(
tm_a_pca(
"PCA",
dat = data_extract_spec(
dataname = "USArrests",
select = select_spec(
choices = variable_choices(
data = data[["USArrests"]], c("Murder", "Assault", "UrbanPop", "Rape")
),
selected = c("Murder", "Assault"),
multiple = TRUE
),
filter = NULL
),
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by PCA Module")
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- rADSL
})
datanames(data) <- "ADSL"
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
app <- init(
data = data,
modules = modules(
tm_a_pca(
"PCA",
dat = data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
data = data[["ADSL"]], c("BMRKR1", "AGE", "EOSDY")
),
selected = c("BMRKR1", "AGE"),
multiple = TRUE
),
filter = NULL
),
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by PCA Module")
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}