find_breaks: Automatically calculate breaks for a number

View source: R/find_breaks.R

find_breaksR Documentation

Automatically calculate breaks for a number

Description

Automatically calculate breaks for a number

Usage

find_breaks(n, breaks = 4, snap = 1, ceiling = FALSE)

Arguments

n

a number to calcluate breaks for

breaks

the maximum number of segments you want to have

snap

the number defining where to snap to the nearest factor

ceiling

if TRUE, n is included in the breaks

Value

a vector of integers

Examples


# find four breaks from 1 to 100
find_breaks(100)

# find four breaks from 1 to 123, rounding to the nearest 20
find_breaks(123, snap = 20)

# note that there are only three breaks here because of the rounding
find_breaks(123, snap = 25)

# Include the value itself
find_breaks(123, snap = 25, ceiling = TRUE)

R4EPI/msfmisc documentation built on Feb. 9, 2023, 4:40 a.m.