paste {utile.tools}R Documentation

Concatenate strings

Description

An augmented version of base::paste() with options to manage 'NA' values.

Usage

paste(..., sep = " ", collapse = NULL, na.rm = FALSE)

paste0(..., collapse = NULL, na.rm = FALSE)

Arguments

...

R objects to be converted to character vectors.

sep

A character. A string to separate the terms.

collapse

A character. An string to separate the results.

na.rm

A logical. Whether to remove NA values from 'x'.

Value

Character vector of concatenated values.

See Also

paste

Examples

# Base paste() NA handling behavior
paste(
  'The', c('red', NA_character_, 'orange'), 'fox jumped', NA_character_, 'over the fence.',
  collapse = ' '
)

# Removal of NA values
paste(
  'The', c('red', NA_character_, 'orange'), 'fox jumped', NA_character_, 'over the fence.',
  collapse = ' ',
  na.rm = TRUE
)

[Package utile.tools version 0.3.0 Index]