R/flag_hierarchy.R
flag_hierarchy.Rd
Flag aggregation by the hierarchical inheritance method
flag_hierarchy(f, flag_list)
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. |
flag_hierarchy
returns the flag as single character that is the highest place in the
predifined hierarchy order for the given set of flags.
#> [1] "e"#> [1] "s"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"))#> [1] "p"#> 2009-01-01 2010-01-01 2011-01-01 2012-01-01 2013-01-01 2014-01-01 2015-01-01 #> "p" "p" "p" "p" "p" "p" "p"