createGroups: Renumbering the Group Labels

View source: R/createGroups.R

createGroupsR Documentation

Renumbering the Group Labels

Description

This function transforms the k group labels to integers 1,...,k in a specified order.

Usage

  createGroups(g, desOrder)

Arguments

g

Vector with group labels.

desOrder

Specified order for the groups.

Details

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.

Value

A vector containing the new group numbers.

Author(s)

Daniel Fischer

Examples

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))

fischuu/gMWT documentation built on April 30, 2023, 7:57 p.m.