In this df, a variable includes observations I want to rename as “lof”, “.”, “missense”. As there are many possibilities for the “missense”, I left it after TRUE (else) when using case_when function. The problem is the function is considering NA as “missense”. How can I tell this function to recognize NA as NA?
df <- df %>%
mutate(type_variant = case_when (str_detect(HGVSprot , regex("fs|Ter", ignore_case = TRUE)) ~ "LoF",
str_detect(HGVSprot, "^\\.$") ~".",
TRUE ~"missense"))