Like suggested, you can do:
v1[as.logical(v1)] <- v2
but it has the disadvantage of overwriting v1
. If you don't want that, you can do:
v3 <- replace(v1, as.logical(v1), v2)
Or this one, which is a little more obscure:
v3 <- `[<-`(v1, as.logical(v1), v2)