setlength: Set Length

Description Usage Arguments Value Examples

View source: R/ShortFunctions.R

Description

Set the length of a vector

Usage

1
setlength(x, y)

Arguments

x

a vector

y

integer of length 0

Value

The vector x truncated if y < length(x) or padded with NA if y > length(x)

Examples

1
2
3
4
5
6
7
8
9
ex1 = 6:10
ex2 = LETTERS[1:10]
ex3 = c(1, 10, NA, 6, 2)
ex4 = c(NA, NA, NA, 6, 5)
setlength(ex1, 7)
setlength(ex2, 5)
setlength(ex2, 15)
setlength(ex3, 4)
setlength(ex4, 50)

debarros/dbTools documentation built on Sept. 27, 2018, 12:16 p.m.