I am writing a piece of code that looks up a 2 letter string (variable y) in another data frame column of strings(test4$names) for each app(variable e)
I am trying to use lists instead of rbind to join each data frame created in the inner loop (x)
for (e in b) {
bi_grams_3 <- bi_final[which(bi_final$app == e),c(1,3)]
test_4 <- test_1[which(test_1$app == e),c(1,3,5)]
for(c in 1:nrow(bi_grams_3))
{
y <-as.character(bi_grams_3[c,1])
aa <- intersect(
grep(word(y,1),test_4$names),
grep(word(y,2),test_4$names)
)
x <- test_4[aa,]
x$root <- y
dat_list[[c]] <- x
#x_all <- rbind(x,x_all)
}
fin_list[[e]] <- dat_list
n=n+1
message(paste(n,e))
}
However, it is not giving me the same result as rbind in the output (x_all). I am getting some extra values in the fin_list (for all except the 1st app).
Also. How can I later rbind the results to get a dataframe?