Learn R Programming

ivmte (version 1.0.1)

groupby: Auxiliary function: grouping rows in data

Description

Auxiliary function that takes in data, and assigns a group number to all observations with the same entries in the columns listed in the vector variables.

Usage

groupby(data, variables, groupname = ".mst.monog",
  countname = ".mst.monoc", count = TRUE)

Arguments

data

data.frame to which the function will assign groups to each row.

variables

vector of the variable/column names in data that will be used to determine the groups.

groupname

name of the column that will be generated to indicate the group.

countname

name of the column that will provide a cumulative count of rows in each group.

count

boolean switch, set to TRUE if the column countname should be generated.

Value

data.frame containing an additional column indicating the group each row falls under. If count is set to TRUE, then an additional column counting the rows within each group is also included.