I am trying to apply an operation which applies on each row of a dataframe. Below is the code.
for(i in 1:nrow(df)){
df$final[i] <- alignfile[alignfile$Response == df$value[i],]$Aligned
}
It is basically doing the vlookup from "alignfile" data frame and making a new column with the successful vlookup of "value" column in data frame "df".
How do i replace this operation with apply family of function so that i can get rid of for loops which is making it slow.
Looking for suggestions. Please feel free for more clarifications.
Thanks