Fills all of an object's (missing and non-missing) values while preserving the object's dimensionality and class.
Usage
fill_all(x, value, ...)
# S3 method for class 'logical'
fill_all(x, value = FALSE, nas = TRUE, ...)
# S3 method for class 'integer'
fill_all(x, value = 0L, nas = TRUE, ...)
# S3 method for class 'numeric'
fill_all(x, value = 0, nas = TRUE, ...)
# S3 method for class 'character'
fill_all(x, value = "0", nas = TRUE, ...)
Details
It should only be defined for objects with values of consistent class ie not standard data.frames.
Methods (by class)
fill_all(logical)
: Fill All for logical Objectsfill_all(integer)
: Fill All for integer Objectsfill_all(numeric)
: Fill All for numeric Objectsfill_all(character)
: Fill All for character Objects
See also
Other fill:
fill_na()
Examples
# logical
fill_all(c(TRUE, NA, FALSE))
#> [1] FALSE FALSE FALSE
fill_all(c(TRUE, NA, FALSE, nas = FALSE))
#> nas
#> FALSE FALSE FALSE FALSE
fill_all(c(TRUE, NA, FALSE, value = NA))
#> value
#> FALSE FALSE FALSE FALSE
# integer
fill_all(matrix(1:4, nrow = 2), value = -1)
#> [,1] [,2]
#> [1,] -1 -1
#> [2,] -1 -1
# numeric
fill_all(c(1, 4, NA), value = TRUE)
#> [1] 1 1 1
fill_all(c(1, 4, NA), value = TRUE, nas = FALSE)
#> [1] 1 1 NA
# character
fill_all(c("some", "words"), value = TRUE)
#> [1] "TRUE" "TRUE"