na2value: Replacing NAs with value

Description Usage Arguments Details Value Examples

Description

Replacing NAs with value

Usage

1
na2value(DT, names = colnames(DT), value = 0)

Arguments

DT

data.frame or data.table.

names

The column names to check and replace NAs.

value

The value to replace NAs with.

Details

na2value uses data.table::set to do the replacement which is efficient and does not copy-on-modify.

Value

A data.table without NAs in the selected columns.

Examples

1
2
df <- data.frame(a = c(1, 2, 3, NA, NA, 5), b = 1:6)
na2value(df)

LyzandeR/D2DF documentation built on May 8, 2019, 3:16 p.m.