replace_names: Replace strings in the names of an object

Description

Replaces strings matching the pattern in the names of the object by the replacement. If applicable, both row and column names could be replaced. This function is a simple wrapper to str_replace_all

Default method that replaces names(object)

Replaces row.names in the object, then dispatches to the default

Replace row.names and col.names in the object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
replace_names(object, pattern, replacement, ...)

## Default S3 method:
replace_names(object, pattern = "\\.",
  replacement = " ", ...)

## S3 method for class 'data.frame'
replace_names(object, pattern = "\\.",
  replacement = " ", replace_rownames = TRUE, replace_colnames = TRUE,
  ...)

## S3 method for class 'matrix'
replace_names(object, pattern = "\\.", replacement = " ",
  replace_rownames = TRUE, replace_colnames = TRUE, ...)

Arguments

object

Object of which the names are to be changed

pattern

Pattern to look for, as defined by a POSIX regular expression

replacement

Replacement string

...

extra arguments to replace_names

replace_rownames

Logical. Should row names be replaced?

replace_colnames

Logical. Should column names be replaced?

Methods (by class)

See Also

str_replace_all


Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.