Good evning i want to run a lag() function inside the loop and make the counter of loop inside the function i wanna say : if lag( review) from the dataset with the index i is equal 1 then give rewiew_tabloid the value 1.
for(i in 1:10) {
if (lag(Dataset$review, n="i")==1) {review_tabloid <-1}
}
could you please help me and tell me what was wrong . sorry this fucnction Lag is new for me. thank you in advance
If you really want to harness the full power of the small example I showed you - I recommend you going through R for Data Science back-to-back. It's well worth the energy input