Extracts the group names of a grouping variable.

getGroupNames(object, grouping, ...)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

grouping

Character value. The grouping variable of interest. Use getGroupingOptions() to obtain all valid input options.

...

Used to absorb deprecated arguments or functions.

Value

Character vector

Examples

library(SPATA2)
library(patchwork)

data("example_data")

object <- example_data$object_UKF269T_diet

p_before <- plotSurface(object, color_by = "bayes_space")

plot(p_before)

getGroupNames(object, grouping = "bayes_space")

object <- relevelGroups(object, grouping = "bayes_space", new_levels = c("1", "2", "3", "7", "6", "5", "4"))

getGroupNames(object, grouping = "bayes_space")

p_afterwards <- plotSurface(object, color_by = "bayes_space")

# different levels -> different order -> different color assignment
p_before + p_afterwards