Fills all of an object's missing values while preserving the object's dimensionality and class.
Usage
# S3 method for class 'nlist'
fill_na(x, value = 0L, ...)
Details
It should only be defined for objects with values of consistent class ie not standard data.frames.
Methods (by class)
fill_na(logical)
: Fill Missing Values for logical Objectsfill_na(integer)
: Fill Missing Values for integer Objectsfill_na(numeric)
: Fill Missing Values for numeric Objectsfill_na(character)
: Fill Missing Values for character Objects
See also
Other fill:
fill_all()
Examples
fill_na(nlist(x = c(2, NA), y = matrix(c(1:3, NA), nrow = 2)))
#> $x
#> [1] 2 0
#>
#> $y
#> [,1] [,2]
#> [1,] 1 3
#> [2,] 2 0
#>
#> an nlist object with 2 numeric elements
fill_na(nlists(nlist(x = c(2, NA)), nlist(x = c(NA_real_, NA))))
#> $x
#> [1] 1 0
#>
#> an nlists object of 2 nlist objects each with 1 numeric element