splice: Move elements

spliceR Documentation

Move elements

Description

Move elements from one list to another list by reference.

Usage

splice(x, y, x_position, y_from, y_to)

Arguments

x

A CppList object to which to add elements.

y

A CppList object, of the same data type as x, from which to extract elements.

x_position

Index at which to insert elements in x.

y_from

Index of the first element to extract from y.

y_to

Index of the last element to extract from y.

Value

Invisibly returns NULL.

See Also

merge, splice_after.

Examples

x <- cpp_list(4:9)
x
# 4 5 6 7 8 9

y <- cpp_list(10:12)
y
# 10 11 12

splice(x, y, 3, 2, 3)
x
# 4 5 11 12 6 7 8 9
y
# 10


cppcontainers documentation built on Sept. 9, 2025, 5:55 p.m.