insert: Insert a set of values at a given position of a vector

Description Usage Arguments Details Value Author(s) Examples

Description

insert introduces a vector at a given position of another vector, displacing to the right all values from that position onwards.

Usage

1
insert(vect, position, value)

Arguments

vect

the vector in which to insert additional values.

position

the position of vector vect at which to insert additional values.

value

the values to be inserted in the vector vect.

Details

The value of position does not need to be a number smaller than or equal to the length of vect, as the missing values will be denoted as NA.

Value

new.vector

the vector resulting after inserting value at the position determined by position.

Author(s)

Aurora Torrente aurora@ebi.ac.uk and Alvis Brazma brazma@ebi.ac.uk

Examples

1
2
3
4
5
6
    # simulated data
    v1 <- 1:10
    v2 <- insert(v1, 4, 0)
    v2 <- insert(v1, 1, rep(0, 5))
    v2 <- insert(v1, 11, "A")
    v2 <- insert(v1, 12, "A")

clustComp documentation built on Nov. 8, 2020, 5:54 p.m.