Давайте немного поэкспериментируем
Сначала несколько примеров значений
x <- 9:2
i <- 3
y <- 100
w1 <- 0.2912
w2 <- 0.3732
Тогда
x
# 9 8 7 6 5 4 3 2
x[i]
# 7
# The ith value in the vector (in this case the 3rd)
w1|w2
# TRUE
# Are either w1 or w2 (or both) non-zero?
w1 <- 0
w1|w2
# TRUE
# One of them are still non-zero
w2 <- 0
w1|w2
# FALSE
# Now neither are non-zero
w1 <- 0.2912
w2 <- 0.3732
# Re-asserting the values
x[i][w1|w2]
# 7
# Returns the 3rd value, as long as w1|w2 returns TRUE
# (give the alternative a try)
x[i][w1|w2] <- y
# Replaces the value at position 3 with the value in y,
# as long as w1|w2 returns TRUE
x[i]
# 100
# the new value at position 3
x
# 9 8 100 6 5 4 3 2
# The altered vector x, with the value of y (100) at position i (3)
index <- 1*(w1|w2)
index
# 1
# Multiplying TRUE or FALSE with 1 returns 1 or 0, respectively.
# Essentially shorthand for as.integer()