Learn R Programming

pmartR (version 2.4.6)

custom_sampnames: Creates custom sample names to be used in plots

Description

This helper function creates custom sample names for plot data object functions

Usage

custom_sampnames(
  omicsData,
  firstn = NULL,
  from = NULL,
  to = NULL,
  delim = NULL,
  components = NULL,
  pattern = NULL,
  ...
)

Value

Object of same class as omicsData, with added column in f_data named 'VizSampNames'.

Arguments

omicsData

an object of the class 'pepData', 'proData', 'metabData', 'lipidData', 'nmrData', or 'seqData', created by as.pepData, as.proData, as.metabData, as.lipidData, as.nmrData, or as.seqData, respectively.

firstn

an integer specifying the first n characters to keep as the sample name. This argument is optional.

from

an integer specifying the start of the range of characters to keep as the sample name. This argument is optional. If this argument is specified, 'to' must also be specified.

to

an integer specifying the end of the range of characters to keep as the sample name. This argument is optional. If this argument is specified, 'from' must also be specified.

delim

character delimiter by which to separate sample name components. This argument is optional. If this argument is specified, 'components' must also be specified.

components

integer vector specifying which components separated by the delimiter should be kept as the custom sample name. This argument is optional. If this argument is specified, 'delim' must also be specified.

pattern

character string specifying the regex pattern to use to extract substrings from the sample names

...

extra arguments passed to regexpr if pattern is specified

Details

This function can be used to create custom (and shorter) sample names to be used when plotting so that axis labels are not so long that they interfere with the graph itself. To use the custom sample names when plotting, specify the optional argument 'use_VizSampNames = TRUE'.