Good evening. I have two vectors, one with binary data
M <- c(1, 0, 0, 1, 0, 0)
and another with non-binary data
C <- c(2.5, 3)
I need to create a function (in R) that assigns a value of vector C, whenever a value of 1 of the vector M is found, that replaces the value of one with the values of C. The example would be:
(2.5, 0, 0, 5.3, 0, 0)
The ideal would be to use if, only I'm not getting to generate that replacement.