

Once you call magicfor(), as you just run for() as usual, the result will be stored in memory automatically. Is there a way were I can determine the number of users_ids (in retweeters) that overlaps with the user_ids (in Followers)? Taking into consideration to compare user 1 in retweeters with user 1 in followers and so on. magicfor() takes a function name, and then reconstructs for() to remember values passed to the specified function in for loops.


lapply() : Loop over a list and evaluate a function on each element. I showed you this R working because it was good practice of for loops for me. Keep a variable R, containing which row were on. In a roundabout way, R is doing exactly this with this for loop. You must create a condition that is true while you want the loop to keep looping, and that becomes. Divided by 105,653 makes an average of 38.1. Note: Like every shortcut, the loop will run out much faster when it is run from the shortcut main screen instead of inside the shortcut (which will make it take a few seconds). Everyone in Aldershot combined is four million years old. This means it will cause the loop to finish as quickly as possible and those remaining 90+ loops will complete in just a second. Rtwts] <- search_tweets(x, n = 500)ĪA2 <- rbind.fill(lapply(AA, as.ame))īut this is combining all the users in one dataframe (but separating with with an extra column that identifies the user number, such as user 1, 2, 3. R has some functions which implement looping in a compact form to make your life easier. So for Aldershot, the total ages of everybody there added up to 4,023,604. # execute `i` loops (one for each obs in users)įlws] <- get_followers(users, n = "all", page = "-1", parse = TRUE, token = NULL)
