Data scrapping an IMDB website

I was trying data scrapping using “rvest” package. I was referring the following blog:

But while setting the missing values for gross_data as NaN I used the exact same loop given. But it is changing every record as NaN. Can anyone please help me with a more simple loop approach? Or tell me what am I doing wrong?
This is what I coded:
for(i in c(12,47,54,64,67,75,85,95,97))
{
a = gross_data[1:(i-1)]
b = gross_data[i:length(gross_data)]
gross_data = append(a,list(“NA”))
gross_data = append(gross_data,b)
}

I am new to R.

© Copyright 2013-2019 Analytics Vidhya