unique_non_numerics: Find all unique non-numeric values

View source: R/non_numerics.R

unique_non_numericsR Documentation

Find all unique non-numeric values

Description

Find all unique non-numeric values

Usage

unique_non_numerics(x, na.rm = TRUE, .sort = TRUE)

Arguments

x

vector to check on

na.rm

remove existing na values before checking

.sort

sort the results

Details

This function is especially useful for figuring out what non-numeric unique values are in in a column that should be numeric so one can easily replace them with another flag. This function can work well with replace_char_flags instead of using nested ifelse statements

See Also

replace_values: to use to replace non-numeric values in a dataframe.

Other Numerics: as_numeric()

Examples

dv <- c(1, 2, 4, "88 (excluded)", "bql", "*")
unique_non_numerics(dv)
df <- tibble::data_frame(ID = 1:3, DV = c("BQL", 0.5, 9))
unique_non_numerics(df$DV)

#using dplyr
library(dplyr)
df %>% filter(!(DV %in% unique_non_numerics(DV)))

metrumresearchgroup/PKPDmisc documentation built on Oct. 21, 2022, 9:41 a.m.