Browse Source

Edit: cover Wait-time fix in Documentation

pull/3/head
janwey 1 year ago
parent
commit
b1c130bc75
2 changed files with 7 additions and 3 deletions
  1. 7
    3
      docs/collector.md
  2. BIN
      docs/collector.pdf

+ 7
- 3
docs/collector.md View File

@@ -808,7 +808,11 @@ structure as the previously used `reddit_post`:
'- ...
```
Since we need to do this for every single post, we can include this into our
for-loop. Everything put together:
for-loop. Because we call the function with only one post-URL at a time, we can
set the wait time between request to zero. However the for-loop will call the
function multiple times regardless, so we should make sure it is actually
waiting before doing so or else we will hit the API-timeout. We can do this with
the `Sys.sleep()` function. Everything put together:
```
comt <- c()
subr <- c()
@@ -824,8 +828,8 @@ for-loop. Everything put together:
rurl[i] <- reddit_post$URL[i]
date[i] <- gsub(x = reddit_post$date[i], pattern = "-", replace = "")
subr[i] <- reddit_post$subreddit[i]
reddit_content <- reddit_content(URL = reddit_post$URL[i])
Sys.sleep(2)
reddit_content <- reddit_content(URL = reddit_post$URL[i], wait_time = 0)
ptns[i] <- reddit_content$post_score
text[i] <- reddit_content$post_text
link[i] <- reddit_content$link

BIN
docs/collector.pdf View File


Loading…
Cancel
Save