col_concat

0th

Percentile

Concatenate all columns of each row in data frame into a string

This function will return a vector, with the same length as the number of rows of the provided data frame. Each element of the vector will be it's corresponding row with all of its values (one for each column) "pasted" together in a string.

Usage
col_concat(data, sep = "")
Arguments
data

A data frame

sep

A string to separate the columns with (default: "")

Value

A vector of rows concatenated into strings

See Also

paste

Aliases
  • col_concat
Examples
# NOT RUN {
col_concat(mtcars)

library(magrittr)            # for piping operator

# you can use "assert_rows", "is_uniq", and this function to
# check if joint duplicates (across different columns) appear
# in a data frame
# }
# NOT RUN {
mtcars %>%
  assert_rows(col_concat, is_uniq, mpg, hp)
  # fails because the first two rows are jointly duplicates
  # on these two columns
# }
# NOT RUN {
mtcars %>%
  assert_rows(col_concat, is_uniq, mpg, hp, wt) # ok

# }
Documentation reproduced from package assertr, version 2.7, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.