Skip to contents

spread x into len elements

Usage

spread_integer(x, len)

Arguments

x

numeric(1). The number to spread

len

numeric(1). The number of times to repeat x

Value

if x is a scalar "whole number" value (see is.wholenumber), the value x repeated len times. If not, an error is thrown.

Examples

spread_integer(3, 1)
#> [1] 3
spread_integer(0, 3)
#> [1] 0 0 0
spread_integer(1, 3)
#> [1] 1 0 0
spread_integer(2, 3)
#> [1] 1 1 0
spread_integer(3, 3)
#> [1] 1 1 1
spread_integer(4, 3)
#> [1] 2 1 1
spread_integer(5, 3)
#> [1] 2 2 1
spread_integer(6, 3)
#> [1] 2 2 2
spread_integer(7, 3)
#> [1] 3 2 2