Thanks.

Your method

   mutate(
      cases = ifelse(
         country == 'Namibia'
            & type == 'confirmed'
            & date == '2021-10-23'
            & cases == 357,
         NA,
         cases
      )
   )

works, as does Rui's

   mutate(
      cases = replace(
         cases,
         which(country == 'Namibia'
            & type == 'confirmed'
            & date == '2021-10-23'
            & cases == 357),
         NA
      )
   )

Thank you both, again.

el

On 2021-10-25 23:14 , Avi Gross via R-help wrote:
> I wonder why it is not as simple as:
>
> Call mutate on the data and have a condition that looks like:
>
> data %>% mutate(cases = ifelse(multiple_cond, NA, cases) -> output
[...]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to