Skip to contents

Combine multiple columns into one

Usage

combine(data, name = combined, columns, sep = "-")

Arguments

data

<data.frame> or <tibble>

name

new column name, unquoted, default is combined

columns

<chr> vector of columns to combine

sep

separator between combined row data, default is "-"

Value

A <tibble> with combined columns

Examples

x <- mock_forager()

x[1, 1] <- ""

combine(x, payer, c("payer", "id"))
#> # A tibble: 10 × 8
#>    payer        class balance date_of_service date_of_release date_of_submission
#>    <chr>        <ord>   <dbl> <date>          <date>          <date>            
#>  1 BCBS-        Seco… 102.    2024-07-02      2024-07-23      2024-07-27        
#>  2 Anthem-00002 Seco… 102.    2024-06-02      2024-06-09      2024-06-11        
#>  3 Anthem-00003 Prim… 150.    2024-12-02      2024-12-05      2024-12-13        
#>  4 Cigna-00004  Seco…   0.513 2024-06-02      2024-06-10      2024-06-10        
#>  5 MAO-00005    Seco… 100.    2024-05-02      2024-05-16      2024-05-19        
#>  6 Medicaid-00… Seco… 171.    2024-11-02      2024-11-09      2024-11-10        
#>  7 Centene-000… Prim… 130.    2024-05-02      2024-05-09      2024-05-15        
#>  8 Medicare-00… Seco… 114.    2024-03-02      2024-03-11      2024-03-14        
#>  9 Medicare-00… Seco… 247.    2024-08-02      2024-08-10      2024-08-11        
#> 10 BCBS-00010   Seco…  52.2   2024-05-02      2024-05-18      2024-05-21        
#> # ℹ 2 more variables: date_of_acceptance <date>, date_of_adjudication <date>