Learn R Programming

spatialEco (version 0.1-7)

insert.values: Insert Values

Description

Inserts new values into a vector at specified positions

Usage

insert.values(x, value, index)

Arguments

x
A vector to insert values
value
Values to insert into x
index
Index position(s) to insert y values into x

Value

A vector with values of y inserted into x and the position(s) defined by the index

Examples

Run this code
 (x=1:10)

 # Insert single value in one location
 insert.values(x, 100, 2) 

 # Insert multiple values in multiple locations 
 insert.values(x, c(100,200), c(2,8)) 

 # Insert single value in multiple locations 
 insert.values(x, NA, c(2,8))

Run the code above in your browser using DataLab