flag_hierarchy {flagr}R Documentation

Flag aggregation by the hierarchical inheritance method

Description

Flag aggregation by the hierarchical inheritance method

Usage

flag_hierarchy(f, flag_list)

Arguments

f

A vector of flags containing the flags of a series for a given set of flags.

flag_list

The predefined hierarchy of allowed flags as a vector of single characters.

Value

flag_hierarchy returns the flag as single character that is the highest place in the predifined hierarchy order for the given set of flags.

Examples

flag_hierarchy(c("p","b","s","b","u","e","b"), flag_list = c("e","s","t"))
flag_hierarchy(c("p","b","s","c","u","d"), flag_list = c("e","s","t"))

flags <- tidyr::spread(test_data[, c(1:3)], key = time, value = flags)
flag_hierarchy(flags[,4],flag_list = c("p","b","s","c","u","e","d"))
apply(flags[, c(2:ncol(flags))],2, flag_hierarchy, flag_list = c("p","b","s","c","u","e","d"))


[Package flagr version 0.3.2 Index]