Collect reddit thread listings from subreddits
Source:R/Collect.listing.reddit.R
, R/zzz.R
Collect.listing.reddit.Rd
Collects thread listings for one or more specified subreddits and structures the data into a dataframe.
Usage
# S3 method for class 'listing.reddit'
Collect(
credential,
endpoint,
subreddits,
sort = "hot",
period = "all",
max = 25,
waitTime = c(6, 8),
ua = getOption("HTTPUserAgent"),
...,
writeToFile = FALSE,
verbose = TRUE
)
collect_reddit_listings(
subreddits,
sort = "new",
period = NULL,
max = 25,
waitTime = c(6, 8),
ua = vsml_ua(),
writeToFile = FALSE,
verbose = TRUE,
...
)
Arguments
- credential
A
credential
object generated fromAuthenticate
with class name"reddit"
.- endpoint
API endpoint.
- subreddits
Character vector. Subreddit names to collect thread listings from.
- sort
Character vector. Listing thread sort order. Options are
"hot"
,"top"
,"new"
, and"rising"
. Default is"hot"
.- period
Character vector. Listing top threads by time period. Only applicable to sort order by
"top"
. Options are"hour"
,"day"
,"week"
,"month"
,"year"
and"all"
. Default is"all"
.- max
Numeric vector. Maximum number of threads in listing to return. Default is
25
.- waitTime
Numeric vector. Time range in seconds to select random wait from in-between url collection requests. Minimum is 3 seconds. Default is
c(6, 8)
for a wait time chosen from between 6 and 8 seconds.- ua
Character string. Override User-Agent string to use in Reddit thread requests. Default is
option("HTTPUserAgent")
value as set by vosonSML.- ...
Additional parameters passed to function. Not used in this method.
- writeToFile
Logical. Write collected data to file. Default is
FALSE
.- verbose
Logical. Output additional information. Default is
TRUE
.