list_null | R Documentation |
Handle Null Values for Text to List Conversions
list_null(par_input = "", alt_na = NULL)
par_input |
A string input, default is "". |
alt_na |
If alt_na is not set to NULL (the default), then it is an alternative string used to represent NA. Usually, this is a string such as "NA", "NaN", etc |
NULL if input is NA, if input is empty, or if input is alt_na (and alt_na is not NULL). Otherwise return a parsed list.
# Convert missing value to null
list_null()
list_null(NA)
list_null("na", alt_na="na")
# Convert non-missing value to list
list_null("'one' = 1, 'two' = 2, 'three' = 3")
# Convert to null when a single vector is missing
list_null("'one' = 1, 'two' = NA, 'three' = 3", alt_na = "NA")
list_null("'one' = 1, NA, 'three' = 3", alt_na = "NA")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.