createGroups | R Documentation |
This function transforms the k group labels to integers 1,...,k in a specified order.
createGroups(g, desOrder)
g |
Vector with group labels. |
desOrder |
Specified order for the groups. |
This function helps to renumber the group labels in a specified way.
The vector desOrder
gives the old numbers as the function of the new numbers.
The first element of desOrder
gives the old number that is transformed to be one, and so on.
The renumbering is used to specify alternative hypotheses.
The output is then a transformed vector g
with new group numbers.
For non-numeric old group labels, the old number is the rank in the lexicographical order.
A vector containing the new group numbers.
Daniel Fischer
g <- c(rep(1,5),rep(2,6),rep(3,4))
createGroups(g,c(2,3,1))
# 'Smallest' letter should become 3, second smallest 2 and largest 1:
g <- sample(c("A","B","C"),10,replace=TRUE)
createGroups(g,c(3,2,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.