null2na: Convert NULL slots in a data.table to NA

View source: R/null2na.R

null2naR Documentation

Convert NULL slots in a data.table to NA

Description

This function searches for NULL elements in a vector containing lists and converts them to the appropriate type of NA. It is useful for transforming columns containing lists of NULL values from Go.Data, as these columns cannot be un-nested until the NULL values are converted to NA.

Usage

null2na(dtcol)

Arguments

dtcol

vector containing lists with NULL slots to convert

Value

the vector with NULLs converted to NAs

Author(s)

Amy Mikhail, amy.mikhail@gmail.com

Examples

 ## Not run: 
 # Loop through a data.table to convert all NULLs to NAs:
 cases[, names(cases) := lapply(.SD, null2na)]
 
## End(Not run)

WorldHealthOrganization/godataR documentation built on May 21, 2023, 11:30 a.m.