Skip to contents

This function allows you to combine the values of two columns, with an option to remove any 'NA' values

Usage

do.combine.cols(dat, col1, col2, na.rm)

Arguments

dat

NO DEFAULT. Data.table.

col1

NO DEFAULT. Name of the column you want to combine into.

col2

NO DEFAULT. Name of the column you want to combine from. This column will be deleted after combination into col1.

na.rm

DEFAULT = TRUE. If NA values are present in the columns, they will be removed.

Value

Returns a data.table with adjusted columns

Author

Thomas M Ashhurst, thomas.ashhurst@sydney.edu.au