col_concat: Concatenate all columns of each row in data frame into a...

Description Usage Arguments Value See Also Examples

View source: R/row-redux.R

Description

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

1
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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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

## End(Not run)

mtcars %>%
  assert_rows(col_concat, is_uniq, mpg, hp, wt) # ok

lorenzwalthert/assertr documentation built on May 20, 2019, 4:06 p.m.