group_prop {DImodelsVis}R Documentation

Combine variable proportions into groups

Description

Combine variable proportions into groups

Usage

group_prop(data, prop, FG = NULL)

Arguments

data

A data frame containing the compositional variables which need to be grouped.

prop

A character/numeric vector indicating the columns containing the compositional variables in 'data'.

FG

A character vector of same length as 'prop' specifying the group each variable belongs to.

Value

A data-frame with additional columns appended to the end that contain the grouped variable proportions.

Examples

library(DImodels)

data(sim1)

head(group_prop(data = sim1, prop = 3:6,
                FG = c("Gr1", "Gr1", "Gr1", "Gr2")))

head(group_prop(data = sim1, prop = 3:6,
                FG = c("Group1", "Group2", "Group1", "Group3")))

## Data is returned as is, if no groups are specified in FG
head(group_prop(data = sim1, prop = 3:6))

[Package DImodelsVis version 1.0.1 Index]