Skip to contents

Vectorised function to calculate number of segments given a max segment length

Usage

n_segments(line_length, max_segment_length)

Arguments

line_length

The length of the line

max_segment_length

The maximum length of each segment

Examples

n_segments(50, 10)
#> [1] 5
n_segments(50.1, 10)
#> [1] 6
n_segments(1, 10)
#> [1] 1
n_segments(1:9, 2)
#> [1] 1 1 2 2 3 3 4 4 5