flag_divide: Assignment of the weights for the multiple flags

Description Usage Arguments Value See Also Examples

Description

This function is used when a single value has multiple flags. The same weight is repeated for each single character.

Usage

1

Arguments

x

A vector with two items. The first item is a string of flags with several characters, the second is a single numerical value of the weight.

Value

flag_divide returns a character matrix with the flags as single characters as the first column and the weight is repeated as the second column. The length of the list is equal to the length of the string of flags.

See Also

flag_weighted

Examples

1
2
3
4
5
flags <- tidyr::spread(test_data[, c(1:3)], key = time, value = flags)
weights <- tidyr::spread(test_data[, c(1, 3:4)], key = time, value = values)
input <- as.data.frame(cbind(flags[,5],weights[,5]),stringsAsFactors = FALSE)[!is.na(flags[,5]),]

do.call(rbind, apply(input,1,flag_divide))

eurostat/flagr documentation built on May 26, 2019, 4:39 p.m.