guess_missing_entries | R Documentation |
Fill in missing values. This function assumes that entries of the id but available in others. The missing data will be filled based on the available values. Ambiguous cases (same id but multiple values) are ignored.
guess_missing_entries(id, values)
id |
identifier vector |
values |
corresponding values with potentially missing information (NAs) |
For instance, we may have authors and author life years (birth and death). The life years may be available for a given author in some entries and missing in others. When the information is unique, this function fills the missing entries where possible. The function checks that the available life years for the given id (author in this example) are unique (ie. to avoid ambiguous mappings, for instance distinct authors with identical name but different birth year). For unique id-value relation, use the unique value to fill in the missing entries for the same id)
A vector with augmented values
## Not run: guess_missing_entries( id = c("Tom", "Tom", "Pete", "Pete", "Pete"), values = c(1, NA, 2, 3, NA)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.