split a positive integer number as a number vector
Arguments
- x
positive integer
- n
length of the output
- method
should be one of
average, random
, or a number vector which length is n
Examples
pos_int_split(12, 3, method = "average")
#> [1] 4 4 4
pos_int_split(12, 3, method = "random")
#> [1] 1 1 10
pos_int_split(12, 3, method = c(1, 2, 3))
#> [1] 2 4 6