powered by
Alter the size of the container by reference.
resize(x, size, value = NULL)
Invisibly returns NULL.
NULL
A cppcontainers object.
cppcontainers
The new size of the container.
The value of new elements. It defaults to 0 for integers and doubles, to "" for strings, and to FALSE for booleans.
0
""
FALSE
If the new size is larger than the former size, the function sets newly added elements in the back to value.
value
v <- cpp_vector(4:9) v # 4 5 6 7 8 9 size(v) # 6 resize(v, 10) v # 4 5 6 7 8 9 0 0 0 0 resize(v, 3) v # 4 5 6
Run the code above in your browser using DataLab