-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.Rmd
69 lines (56 loc) · 1.37 KB
/
index.Rmd
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!-- badges: start -->
[![Build Status](https://travis-ci.org/news-r/webhoser.svg?branch=master)](https://travis-ci.org/news-r/webhoser)
<!-- badges: end -->
```{r, include=FALSE}
library(htmltools)
```
```{r, echo=FALSE}
div(
class = "row",
div(
class = "col-md-4",
img(
src = "logo.png",
class = "img-responsive responsive-img"
)
),
div(
class = "col-md-8",
"R wrapper to the",
a(
"webhose.io",
href = "https://webhose.io/",
target = "_blank"
),
"API."
)
)
br()
```
## Install
```r
devtools::install_github("news-r/webhoser")
```
## Setup
1. Visit [webhose.io](https://webhose.io/)
2. Visit your [dashboard](https://webhose.io/dashboard).
3. Use the "Active API Key" at the bottom with `wh_token`.
## Examples
``` r
wh_token("xXX-x0X0xX0X-00X") # setup token
# webhoser object
wh_news(q = '"R programming language" is_first:true language:english site_type:news') -> news
# basic
# collect results
wh_news(q = '"R programming language"') %>% # get news
wh_collect() -> basic
# flatten results
wh_news(q = '"R programming language" OR rstats') %>% # get news
wh_collect(TRUE) -> flat # flatten results
# get three pages on the rstats
# format dates
wh_news(q = '"R programming language" OR rstats') %>%
wh_paginate(3) %>%
wh_collect() %>%
dplyr::mutate(published = wh_date(published)) -> rstats
```