Learn R Programming

discretes (version 0.1.0)

integers: Integer numeric series

Description

Use integers() to create a numeric series whose discrete values are integers within a specified range, possibly unbounded on either end. Use natural0() and natural1() for the natural numbers starting at 0 or 1.

Usage

integers(from = -Inf, to = Inf)

natural1()

natural0()

Value

A numeric series (arithmetic, class "dsct_arithmetic") whose discrete values are the integers in the specified range.

Arguments

from, to

Numeric values defining the range of integers. Defaults to -Inf and Inf, representing all integers; the series is not closed, so -Inf and Inf are never discrete values.

See Also

arithmetic()

Examples

Run this code
integers()                  # All integers
integers(from = 0)          # Non-negative integers
integers(to = 1.5)          # Ends at 1.
integers(-5, 5) # Integers from -5 to 5.
natural1()
natural0()

# Infinity is never contained in the series.
has_discretes(integers(), Inf)

Run the code above in your browser using DataLab