null2na: Turn Null Into Character "NA"

Description Usage Arguments Value Examples

View source: R/utils.R

Description

This function turns NULL in a list into character "NA", which can be very useful when processing JSON data that has null values.

Usage

1

Arguments

x

A list

Value

If any element from the input list is NULL, they will be turned into character "NA". Otherwise, return the original list.

Examples

1
2
3
4
5
6
7
8
## Not run: 
result <- mysql_read("SELECT userAgent FROM ...", "log")
ua <- purrr::map_df(
  result$userAgent,
  ~ null2na(jsonlite::fromJSON(.x, simplifyVector = FALSE))
)

## End(Not run)

wikimedia/wikimedia-discovery-wmf documentation built on Feb. 7, 2021, 12:19 a.m.