Browse Source

Edit: cover Wait-time fix in Documentation

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`:
808 808
     '- ...
809 809
 ```
810 810
 Since we need to do this for every single post, we can include this into our
811
-for-loop. Everything put together:
811
+for-loop. Because we call the function with only one post-URL at a time, we can
812
+set the wait time between request to zero. However the for-loop will call the
813
+function multiple times regardless, so we should make sure it is actually
814
+waiting before doing so or else we will hit the API-timeout. We can do this with
815
+the `Sys.sleep()` function. Everything put together:
812 816
 ```
813 817
   comt <- c()
814 818
   subr <- c()
@@ -824,8 +828,8 @@ for-loop. Everything put together:
824 828
     rurl[i] <- reddit_post$URL[i]
825 829
     date[i] <- gsub(x = reddit_post$date[i], pattern = "-", replace = "")
826 830
     subr[i] <- reddit_post$subreddit[i]
827
-
828
-    reddit_content <- reddit_content(URL = reddit_post$URL[i])
831
+    Sys.sleep(2)
832
+    reddit_content <- reddit_content(URL = reddit_post$URL[i], wait_time = 0)
829 833
     ptns[i] <- reddit_content$post_score
830 834
     text[i] <- reddit_content$post_text
831 835
     link[i] <- reddit_content$link

BIN
docs/collector.pdf View File


Loading…
Cancel
Save