replace_names: Replace strings in the names of an object

Description Usage Arguments Methods (by class) See Also

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)

  • default: Replace names of an object

  • data.frame: Replace names of a data.frame

  • matrix: Replace names in a matrix

See Also

str_replace_all



Search within the crtests package
Search all R packages, documentation and source code

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

Please suggest features or report bugs with the GitHub issue tracker.

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