Description Usage Arguments See Also Examples
View source: R/recode_as_na_str.R
Recode as NA based on string match
1 2 3 4 5 6 7 |
df |
A data.frame object |
pattern_type |
One of contains', 'starts_with' or 'ends_with'. |
pattern |
A character pattern to match |
case_sensitive |
Defaults to FALSE. Patterns are case insensitive if TRUE |
... |
Other arguments to grepl |
1 2 3 4 5 | partial_match <- data.frame(A=c("Hi","match_me","nope"), B=c(NA, "not_me","nah"))
# Replace all that end with "me" with NA
recode_as_na_str(partial_match,"ends_with","me")
# Do not recode, ie case-sensitive
recode_as_na_str(partial_match,"ends_with","ME", case_sensitive=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.