FOR LOOP with Google Suggest API

Hi there !

I want to use Google Suggest API to get keyword's suggestion from different keywords (about 350)
So I need to use FOR LOOP in order to get suggestions for each keyword in the list.
Output wanted : Dataframe with all keywords found in one column

Here is my code, but it needs to be optimized to get to the result wanted

#Load my keywords list 
mykeyword = read.csv(file = "mykeyword.csv", sep=";", header = TRUE)

#Initiate the first iteration
df = googleSuggest(mykeyword[1,], language = "fr", walkThrough = FALSE,
              questions = FALSE, prepositions = FALSE, comparisons = TRUE)

#Start the loop
for (i in 1: nrow(mykeyword)) {
 df[i] =  googleSuggest(mykeyword[i,], language = "fr", walkThrough = FALSE,
                questions = FALSE, prepositions = FALSE, comparisons = TRUE)
 df_final = rbind(df,df[i])
}

Does someone can help here ?
Thanks in advance

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.