Learn R Programming

cppcontainers (version 1.0.4)

print: Print container data

Description

Print the data in a container.

Usage

print(x, ...)

Value

Invisibly returns NULL.

Arguments

x

A cppcontainers object.

...

An ellipsis for compatibility with the generic method. Accepts the parameters n, from, and to. See to_r for their effects. A difference to to_r is that their omission does not induce the function to print all elements, but to print the first 100 elements. Stacks, queues, and priority queues ignore the ellipsis and only print the top or first element.

Details

print has no side effects. Unlike to_r, it does not remove elements from stacks or queues.

See Also

sorting, to_r, type.

Examples

Run this code
s <- cpp_set(4:9)

print(s)
# 4 5 6 7 8 9

print(s, n = 3)
# 4 5 6

print(s, n = -3)
# 9 8 7

print(s, from = 5, to = 7)
# 5 6 7

v <- cpp_vector(4:9)

print(v, n = 2)
# 4 5

print(v, from = 2, to = 3)
# 5 6

print(v, from = 3)
# 6 7 8 9

Run the code above in your browser using DataLab