I have a logical vector
vector1 <- c(F,F,T,F,F)
and I want to create a vector2 with the same values as vector1 but when vector1[i] == TRUE vector2[i-1], vector2[i] and vector2[i+1] has to be also TRUE.
What is the best way to do this? the ideal would be to create a function also since I will have to this for many other vectors...