Skip to content

Instantly share code, notes, and snippets.

@gdemin
Created March 18, 2016 09:04
Show Gist options
  • Save gdemin/7cb4cc0a391f2c0bca1a to your computer and use it in GitHub Desktop.
Save gdemin/7cb4cc0a391f2c0bca1a to your computer and use it in GitHub Desktop.
comments_and_post$rang_posta = rep(NA, length(comments_and_post$post_id))
for (i in 1:length(comments_and_post$post_id)){
if (!is.na(comments_and_post$id[i])) {
comments_and_post$rang_posta[i] <- length(
unique(
comments_and_post$post_id[
comments_and_post1$post_id>comments_and_post1$post_id[i] &
comments_and_post$post_owner_id == comments_and_post$post_owner_id[i] &
comments_and_post$post_date.x < comments_and_post$date[i]
]
)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment