Thank you very much,

'which' does the trick :-)-O

greetings, el

On 2021-10-25 19:06 , Rui Barradas wrote:
Hello,

Here is a pipe to replace based on the composite condition.
It uses ?base::replace with an integer index vector.

[...]
library(dplyr)

data(coronavirus, package = "coronavirus")

coronavirus %>%
[...]
   mutate(cases = replace(cases,
                          which(country == 'Namibia' &
                                  date == '2021-10-23' &
                                  cases == 357), NA)
   )
[...]

Hope this helps,

Rui Barradas
[...]

______________________________________________
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