Skip to contents

split a positive integer number as a number vector

Usage

pos_int_split(x, n, method = "average")

Arguments

x

positive integer

n

length of the output

method

should be one of average, random, or a number vector which length is n

Value

number vector

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