flag_divide {flagr} | R Documentation |
Assignment of the weights for the multiple flags
Description
This function is used when a single value has multiple flags. The same weight is repeated for each single character.
Usage
flag_divide(x)
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
Examples
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))
[Package flagr version 0.3.2 Index]