create_group | R Documentation |
Create Groups from Index List
create_group(x, list_x)
x |
|
list_x |
|
integer()
vector()
of numeric index of groups
# Numeric
x <- c(1, 4, 2, 3, NA, 2, 7)
g <- list(a = 1:2, b = 3:4)
create_group(x, g)
# Character
x <- c("M", "F", "F", NA, "M", "N", "F")
g <- list(m = "M", f = "F")
create_group(x, g)
# Factor
x <- factor(c("L", "S", "M", NA, "M", "H"))
g <- list(s = "S", m = "M", l = "L")
create_group(x, g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.