x <- 3:7
# Increase the length of `x` from 5 to 10:
seq_length(x, 10)
# Modify `x` directly (but get
# the same results otherwise):
seq_length(x) <- 10
x
# Likewise, decrease the length:
x <- 3:7
seq_length(x, 2)
seq_length(x) <- 2
x
# The functions are sensitive to decimal levels.
# They also return a string vector if (and only if)
# `x` is a string vector:
x <- seq_endpoint(from = 0, to = 0.5)
x
seq_length(x, 10)
seq_length(x) <- 10
x
# Same with decreasing the length:
seq_length(x, 2)
seq_length(x) <- 2
x
Run the code above in your browser using DataLab