Skip to contents

Unite Columns of a Table in a dm object.

Usage

dm_unite(adam_db, dataset, cols, sep = ".", new = NULL)

Arguments

adam_db

(dm) object to be transformed.

dataset

(string) the name of a table in the adam_db object.

cols

(character) the name of the columns to unite.

sep

(string) the separator for the new column name.

new

(string) the name of the new column. If NULL the concatenation of cols separated by sep is used.

Value

dm object with a united column.

Examples

x <- dm_unite(dm::dm_nycflights13(), "airlines", c("carrier", "name"), new = "FUSION")
x$airlines
#> # A tibble: 15 × 3
#>    carrier name                        FUSION                        
#>    <chr>   <chr>                       <fct>                         
#>  1 9E      Endeavor Air Inc.           9E.Endeavor Air Inc.          
#>  2 AA      American Airlines Inc.      AA.American Airlines Inc.     
#>  3 AS      Alaska Airlines Inc.        AS.Alaska Airlines Inc.       
#>  4 B6      JetBlue Airways             B6.JetBlue Airways            
#>  5 DL      Delta Air Lines Inc.        DL.Delta Air Lines Inc.       
#>  6 EV      ExpressJet Airlines Inc.    EV.ExpressJet Airlines Inc.   
#>  7 F9      Frontier Airlines Inc.      F9.Frontier Airlines Inc.     
#>  8 FL      AirTran Airways Corporation FL.AirTran Airways Corporation
#>  9 HA      Hawaiian Airlines Inc.      HA.Hawaiian Airlines Inc.     
#> 10 MQ      Envoy Air                   MQ.Envoy Air                  
#> 11 UA      United Air Lines Inc.       UA.United Air Lines Inc.      
#> 12 US      US Airways Inc.             US.US Airways Inc.            
#> 13 VX      Virgin America              VX.Virgin America             
#> 14 WN      Southwest Airlines Co.      WN.Southwest Airlines Co.     
#> 15 YV      Mesa Airlines Inc.          YV.Mesa Airlines Inc.