mine_ptt: Crawl the selected board post and store into PTTmineR.

Description Usage Arguments Value Examples

View source: R/main-caller.R

Description

You can use following arguments to get/filter the PTT post data you want. Note that you need at least choose which board you want to crawl.

Usage

1
2
3
4
5
6
7
8
9
mine_ptt(
  ptt.miner,
  board = NULL,
  keyword = NULL,
  author = NULL,
  recommend = NULL,
  min.date = NULL,
  last.n.page = NULL
)

Arguments

ptt.miner

a R6 class object uses PTTmineR$new() to create.

board

a string. PTT board you want to crawl.

keyword

a string. The keyword you want to search on selected board.

author

a string. The post author you want to search on selected board.

recommend

a number. The number of net recommend you want to filter.

min.date

a date format string. The farthest date you want to set.

last.n.page

a number. The number of page you wnat to crawl.

Value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# assume that rookie_miner is an object using `PTTmineR$new()` to create
# get all Gossiping posts
## Not run: rookie_miner %>%
    mine_ptt(board = "Gossiping")
## End(Not run)

# get all Gossiping posts to filter by keyword 'youtuber'
## Not run: rookie_miner %>%
    mine_ptt(board = "Gossiping", keyword = "youtuber")
## End(Not run)

# get all Gossiping posts to filter by keyword 'youtuber' and
# net recommend nuber 10.
## Not run: rookie_miner %>%
    mine_ptt(board = "Gossiping", recommend = 10)
## End(Not run)

# if you want to do multiple crawling task on one eval,
# you can use multiple `%>%` :
## Not run: rookie_miner %>%
    mine_ptt(board = "Gossiping", recommend = 10) %>%
    mine_ptt(board = "Soft_job", keyword = "python")
## End(Not run)

# or use `purrr::pwalk()`:
## Not run: board_list <- c("Gossiping", "Soft_job", "Beauty")
pwalk(board_list, ~mine_ptt(board = .x, recommend = 10))
## End(Not run)
# why `pwalk()`? because all PTTmineR's functions are
# side-effect funciton. The data will return to rookie_miner.

shihjyun/PTTmineR documentation built on Oct. 22, 2020, 2:46 a.m.