View source: R/PA.EMOA.dataprocessing.R
categorize | R Documentation |
Given a data frame and a grouping column of type factor or character this function generates a new grouping column which groups the groups.
categorize(df, col, categories, cat.col, keep = TRUE, overwrite = FALSE)
df |
[ |
col |
[ |
categories |
[ |
cat.col |
[ |
keep |
[ |
overwrite |
[ |
[data.frame
]
df = data.frame(
group = c("A1", "A1", "A2", "A2", "B1", "B2"),
perf = runif(6),
stringsAsFactors = FALSE)
df2 = categorize(df, col = "group", categories = list(A = c("A1", "A2"), B = c("B1", "B2")), cat.col = "group2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.