View source: R/ggplot_mass_dataset.R
ggplot_mass_dataset | R Documentation |
This function generates a ggplot2 visualization for a mass_dataset object. You can choose the direction of the visualization (either "variable" or "sample"), specify the variable or sample of interest, and create various plots based on the chosen direction and data.
ggplot_mass_dataset(
object,
direction = c("variable", "sample"),
variable_index = 1,
variable_id,
sample_index = 1,
sample_id
)
object |
A mass_dataset object. |
direction |
A character vector specifying the direction of the visualization. It can be either "variable" or "sample". Default is "variable". |
variable_index |
An integer specifying the index of the variable of interest. If not provided, you can use 'variable_id' to specify the variable by its ID. |
variable_id |
A character string specifying the ID of the variable of interest. If provided, 'variable_index' will be ignored. |
sample_index |
An integer specifying the index of the sample of interest. If not provided, you can use 'sample_id' to specify the sample by its ID. |
sample_id |
A character string specifying the ID of the sample of interest. If provided, 'sample_index' will be ignored. |
A ggplot2 plot object.
Xiaotao Shen shenxt1990@outlook.com
data("expression_data")
data("sample_info")
data("variable_info")
object =
create_mass_dataset(
expression_data = expression_data,
variable_info = variable_info,
sample_info = sample_info
)
library(ggplot2)
ggplot_mass_dataset(object, direction = "variable",
variable_index = 1) +
geom_boxplot(aes(x = class, color = class)) +
geom_jitter(aes(x = class, color = class))
object %>%
`+`(1) %>%
log(10) %>%
scale() %>%
ggplot_mass_dataset(direction = "sample",
sample_index = 2) +
geom_boxplot(aes(x = 1)) +
geom_jitter(aes(x = 1, color = mz))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.