Learn R Programming

SSBtools (version 0.8.0)

RowGroups: Create numbering according to unique rows

Description

Create numbering according to unique rows

Usage

RowGroups(x, returnGroups = FALSE, returnGroupsId = FALSE)

Arguments

x

Data frame or matrix

returnGroups

When TRUE unique rows are returned

returnGroupsId

When TRUE Index of unique rows are returned

Value

A vector with the numbering or, according to the arguments, a list with more output.

Examples

Run this code
# NOT RUN {
a <- data.frame(x = c("a", "b"), y = c("A", "B", "A"), z = rep(1:4, 3))
RowGroups(a)
RowGroups(a, TRUE)
RowGroups(a[, 1:2], TRUE, TRUE)
RowGroups(a[, 1, drop = FALSE], TRUE)
# }

Run the code above in your browser using DataLab