collapseToString: Collapse to string

Description Usage Arguments Value Note See Also Examples

Description

Collapse to string

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
collapseToString(object, ...)

## S4 method for signature 'atomic'
collapseToString(
  object,
  sep = ", ",
  sort = FALSE,
  removeNA = FALSE,
  unique = FALSE
)

## S4 method for signature 'matrix'
collapseToString(
  object,
  sep = ", ",
  sort = FALSE,
  removeNA = FALSE,
  unique = FALSE
)

## S4 method for signature 'data.frame'
collapseToString(
  object,
  sep = ", ",
  sort = FALSE,
  removeNA = FALSE,
  unique = FALSE
)

## S4 method for signature 'DataFrame'
collapseToString(
  object,
  sep = ", ",
  sort = FALSE,
  removeNA = FALSE,
  unique = FALSE
)

Arguments

object

Object.

sep

character(1). Separator. Defaults to comma.

sort

logical(1). Sort values.

removeNA

logical(1). Remove NA values.

unique

logical(1). Unique values.

...

Additional arguments.

Value

Note

Updated 2019-08-18.

See Also

toString().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## character ====
groceries <- c(NA, NA, "milk", "eggs", "eggs", "veggies")
collapseToString(
    groceries,
    unique = TRUE,
    sort = TRUE,
    removeNA = TRUE
)
collapseToString(
    groceries,
    unique = FALSE,
    sort = FALSE,
    removeNA = FALSE
)

## numeric ====
collapseToString(seq(1:5))

## logical ====
collapseToString(c(TRUE, FALSE))
collapseToString(c(NA, NaN))

## data.frame ====
datasets::iris %>%
    head() %>%
    collapseToString(sort = TRUE, unique = TRUE) %>%
    t()

acidgenomics/basejump documentation built on Aug. 15, 2020, 10:21 a.m.