replace_portion: Find and Replace a Portion of a Vector

Description Usage Arguments Value Author(s) Examples

View source: R/replace_portion.R

Description

Searches for a pattern in a vector and replaces it with a provided replacement pattern.

Usage

1

Arguments

invec

The input vector.

find

What is the sequence that you're looking for?

replace

What do you want to replace the values with?

Value

A vector the same length as the input vector.

Author(s)

Ananda Mahto

Examples

1
2
x <- c(1, 2, 3, 1, 0, 1, 0, 1, 2, 3, 4, 1, 0, 1)
replace_portion(x, c(1, 0, 1), c(9, 9, 9))

mrdwab/SOfun documentation built on June 20, 2020, 6:15 p.m.