addUnionGroup: Grouping helpers

View source: R/PA.EMOA.dataprocessing.R

addUnionGroupR Documentation

Grouping helpers

Description

Consider a data frame with results of multi-objective stochastic optimizers on a set of problems from different categories/groups (say indicated by column “group”). Occasionally, it is useful to unite the results of several groups into a meta-group. The function addUnionGroup aids in generation of such a meta-group while function addAllGroup is a wrapper around the former which generates a union of all groups.

Usage

addUnionGroup(df, col, group, values)

addAllGroup(df, col, group = "all")

Arguments

df

[data.frame]
Data frame.

col

[character(1)]
Column name of group-column.

group

[character(1)]
Name for new group.

values

[character(1)]
Subset of values within the value range of column col.

Value

[data.frame] Modified data frame.

Examples

df = data.frame(
  group = c("A1", "A1", "A2", "A2", "B"),
  perf = runif(5),
  stringsAsFactors = FALSE)

df2 = addUnionGroup(df, col = "group", group = "A", values = c("A1", "A2"))
df3 = addAllGroup(df, col = "group", group = "ALL")

ecr documentation built on March 31, 2023, 10:07 p.m.