Title: | Fill Missing Values in Vectors |
---|---|
Description: | Edit vectors to fill missing values, based on the vector itself. |
Authors: | Jelger van Zaane [aut, cre] |
Maintainer: | Jelger van Zaane <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-02-15 03:23:24 UTC |
Source: | https://github.com/jelger12/fillr |
Check if some missing values are present, but not all are missing. returns a boolean. This check is done to save time for vectors where filling is not needed
check_some_missing(x)
check_some_missing(x)
x |
the vector to check |
TRUE or FALSE
wrapper function to do check and call all fill_vector functions
fill_missing(x, min_known_n = NULL, min_known_p = NULL, type)
fill_missing(x, min_known_n = NULL, min_known_p = NULL, type)
x |
The vector to fill |
min_known_n |
numeric value: the minimum number of not-missing values |
min_known_p |
numeric value between 0 and 1: the minimum fraction of not-missing values |
type |
the type of fill missing function to be called |
Fill all missing values for an interval observed in the vector
fill_missing_interval(x, min_known_n = NULL, min_known_p = NULL)
fill_missing_interval(x, min_known_n = NULL, min_known_p = NULL)
x |
The vector to fill |
min_known_n |
numeric value: the minimum number of not-missing values |
min_known_p |
numeric value between 0 and 1: the minimum fraction of not-missing values |
a filled vector
fill_missing_interval(c(NA, 1, 2, NA)) fill_missing_interval(c(NA, 10, 20, NA))
fill_missing_interval(c(NA, 1, 2, NA)) fill_missing_interval(c(NA, 10, 20, NA))
Fill all missing values in a vector with the last value if it is known.
fill_missing_last(x, min_known_n = NULL, min_known_p = NULL)
fill_missing_last(x, min_known_n = NULL, min_known_p = NULL)
x |
The vector to fill |
min_known_n |
numeric value: the minimum number of not-missing values |
min_known_p |
numeric value between 0 and 1: the minimum fraction of not-missing values |
a filled vector
fill_missing_last(c(1, 2, NA)) fill_missing_last(c(NA, 1, 2, NA))
fill_missing_last(c(1, 2, NA)) fill_missing_last(c(NA, 1, 2, NA))
Fill all missing values in a vector with the maximum value if it is known.
fill_missing_max(x, min_known_n = NULL, min_known_p = NULL)
fill_missing_max(x, min_known_n = NULL, min_known_p = NULL)
x |
The vector to fill |
min_known_n |
numeric value: the minimum number of not-missing values |
min_known_p |
numeric value between 0 and 1: the minimum fraction of not-missing values |
a filled vector
fill_missing_max(c(1, 2, NA)) fill_missing_max(c(NA, 1, 2, NA))
fill_missing_max(c(1, 2, NA)) fill_missing_max(c(NA, 1, 2, NA))
Fill all missing values in a vector with the minimum value if it is known.
fill_missing_min(x, min_known_n = NULL, min_known_p = NULL)
fill_missing_min(x, min_known_n = NULL, min_known_p = NULL)
x |
The vector to fill |
min_known_n |
numeric value: the minimum number of not-missing values |
min_known_p |
numeric value between 0 and 1: the minimum fraction of not-missing values |
a filled vector
fill_missing_min(c(1, 2, NA)) fill_missing_min(c(NA, 1, 2, NA))
fill_missing_min(c(1, 2, NA)) fill_missing_min(c(NA, 1, 2, NA))
Fill all missing values in a vector with the previous value if it is known.
fill_missing_previous(x, min_known_n = NULL, min_known_p = NULL)
fill_missing_previous(x, min_known_n = NULL, min_known_p = NULL)
x |
The vector to fill |
min_known_n |
numeric value: the minimum number of not-missing values |
min_known_p |
numeric value between 0 and 1: the minimum fraction of not-missing values |
a filled vector
fill_missing_previous(c(1, 2, NA)) fill_missing_previous(c(NA, 1, 2, NA))
fill_missing_previous(c(1, 2, NA)) fill_missing_previous(c(NA, 1, 2, NA))
Fill all missing values in a vector with the same value if it is known. Only fills the value when all known values are the same
fill_missing_strict(x, min_known_n = NULL, min_known_p = NULL)
fill_missing_strict(x, min_known_n = NULL, min_known_p = NULL)
x |
The vector to fill |
min_known_n |
numeric value: the minimum number of not-missing values |
min_known_p |
numeric value between 0 and 1: the minimum fraction of not-missing values |
a filled vector
fill_missing_strict(c(NA, 1))
fill_missing_strict(c(NA, 1))
Returns a vector with all missing values filled with another value
fill_value(x, value)
fill_value(x, value)
x |
vectors. All inputs should have the same length |
value |
a value with the same class as x |
vector with the same length as the first vector
fill_value(c(NA,1), 2)
fill_value(c(NA,1), 2)
fill_vector_interval
fill_vector_interval(x)
fill_vector_interval(x)
x |
the vector to be filled |
fill_vector_last
fill_vector_last(x, x_na_omit)
fill_vector_last(x, x_na_omit)
x |
the vector to be filled |
x_na_omit |
the x vector without NA values |
fill_vector_max
fill_vector_max(x, x_na_omit)
fill_vector_max(x, x_na_omit)
x |
the vector to be filled |
x_na_omit |
the x vector without NA values |
fill_vector_min
fill_vector_min(x, x_na_omit)
fill_vector_min(x, x_na_omit)
x |
the vector to be filled |
x_na_omit |
the x vector without NA values |
fill_vector_previous
fill_vector_previous(x)
fill_vector_previous(x)
x |
the vector to be filled |
fill_vector_strict
fill_vector_strict(x, x_na_omit)
fill_vector_strict(x, x_na_omit)
x |
the vector to be filled |
x_na_omit |
the x vector without NA values |