Replace: Replace

Description Usage Arguments Value Examples

View source: R/Replace.R

Description

There are two methods in this function. You can use repalce many objects to one by form and to. pattern can be used to one object replaced by the other one.

Usage

1
Replace(data, from, to, pattern, ignore.case = FALSE)

Arguments

data

can be number, strings, verctors, dataframe or matrix.

from

replaced stings

to

replacements

pattern

like from:to

ignore.case

logical, whether to ignore case

Value

replaced data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Replace(data = 232,from = 2,to = 1)
Replace(data = c(232,'a4b'),
        from = c(2,'.*4'),to = 1,
        pattern = c('a:e','b:h'))
df = data.frame(
  a = c(232, 452),
  b = c("nba", "cba")
)
Replace(data = df,
        from = 2,to = 1,
        pattern = c('a:e','b:h'))

do documentation built on July 16, 2021, 9:08 a.m.