R: Replace pattern everywhere in a data.frame

replace_pattern {thinkr} | R Documentation

## Replace pattern everywhere in a data.frame

### Description

Replace pattern everywhere in a data.frame

### Usage

    replace_pattern(dataset, pattern, replacement, exact = FALSE)

### Arguments

`dataset` | a data.frame
`pattern` | Pattern to look for.
`replacement` | A character of replacements.
`exact` | a boolean if TRUE the whole value need ton match

### Value

a data.frame

### Examples

    library(dplyr)
    library(tidyr)
    dataset <-
    data.frame(a=as.factor(letters)[1:7],b=letters[1:7],c=1:7,stringsAsFactors = FALSE) %>%
    unite("fus",a,b,remove=FALSE,sep="")
    dataset %>% replace_pattern("a",'"XXX') %>% summary()

[Package thinkr version 0.13 Index]