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-06-25      2024-07-16      2024-07-20        
#>  2 Anthem-00002 Seco… 102.    2024-05-25      2024-06-01      2024-06-03        
#>  3 Anthem-00003 Prim… 150.    2024-11-25      2024-11-28      2024-12-06        
#>  4 Cigna-00004  Seco…   0.513 2024-05-25      2024-06-02      2024-06-02        
#>  5 MAO-00005    Seco… 100.    2024-04-25      2024-05-09      2024-05-12        
#>  6 Medicaid-00… Seco… 171.    2024-10-25      2024-11-01      2024-11-02        
#>  7 Centene-000… Prim… 130.    2024-04-25      2024-05-02      2024-05-08        
#>  8 Medicare-00… Seco… 114.    2024-02-25      2024-03-05      2024-03-08        
#>  9 Medicare-00… Seco… 247.    2024-07-25      2024-08-02      2024-08-03        
#> 10 BCBS-00010   Seco…  52.2   2024-04-25      2024-05-11      2024-05-14        
#> # ℹ 2 more variables: date_of_acceptance <date>, date_of_adjudication <date>