Replace_ex: Replace Exactly

Description Usage Arguments Value Examples

View source: R/Replace_ex.R

Description

Replace Exactly

Usage

1
Replace_ex(x, from, to, pattern)

Arguments

x

vector, dataframe or matrix

from

replaced stings

to

replacements

pattern

a special pattern, see examples for detail

Value

replaced data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
a=c(1,2,3,1,4)
Replace_ex(x = a,from = c(1,2),to=5)
Replace_ex(x=a,pattern = c('1:5','2:5'))
Replace_ex(x=a,pattern = '[12]:5')


a=data.frame(v=c(1,2,3,2,4),
             b=c(7,8,9,4,6))
Replace_ex(x = a,from = c(1,2),to=5)
Replace_ex(x=a,pattern = c('1:5','2:5'))

yikeshu0611/do documentation built on Aug. 5, 2021, 4:17 p.m.