set.seed(2956855)
data <- sample(1:10,100,TRUE)
paths <- matrix(sample(1:10,500,TRUE),100,5)
cluster <- matrix(sample(1:10,500,TRUE),100,5)

C1 <- cluster
C1[na.omit(match(paths[1:100,1],data[1:10])),4] = paths[!is.na(match(paths[1:100,1],data[1:10])),2]

C2 <- cluster
for (i in 1:10)
   for (j in 1:100)
        if (data[i] == paths[j,1])
            C2[i,4] <- paths[j,2]

all.equal(C1,C2)

[1] "Mean relative difference: 0.82353"