Description Usage Arguments Details Value Note Examples
news_search
provides an interface to the newsfreq.com
news keyword search API
1 2 3 4 | news_search(keywords = NA, target = "", date_from = (Sys.Date() - 1),
date_to = (Sys.Date() - 1), source = "", summarize = "monthly")
is.newsfreq(x)
|
keywords |
search term(s) to query (see Details for specifics) |
target |
news article component to search in (see Details for valid values and their meaning) |
date_from |
start date for the search (<= |
date_to |
end date for search (>= |
source |
filter search by news source. You can filter your search by news organization. Entering 'Fox News' or 'The Boston Globe' will search only articles from sources matching that name. Full list available on NewsBank |
summarize |
Either " |
newsfreq.com
's interface shows you the frequency that given keywords appear in
American News Media and can be used to look at trends in news reporting.
news_search
provides programmatic access to the search function, returning results in an R data frame where
additional analyses can be performed or data can be visualized.
You can use boolean operators AND
and OR
with parentheses to specify multiple terms in keywords
.
The target
parameter controls which "field" in news stories are queried. Valid values are:
""
Search all article fields (the default)
lead
Search in article lead paragraph
title
Search in article headlines
topics
Search in terms identified as index terms by the article provider
author
Search for articles by a particular author
section
Search for articles appearing in a particular news section
source
Search for articles from a particular news source
Search dates must not be in the future and must also not be on the current day (they won't be in the API database).
They can be an atomic character vector in a format as.Date
will recognize or
anything that can be coerced to a Date
class.
data.frame
(with additional class of newsfreq
) of search
results. If summarize
is "monthly
",
then the results will also include year
, month
and
month_abb
. For "annual
", only year
will be added to
the results.
The "percent
" value is a per-annum calculation and will only be calculated
and added to the results of searches that are summarized monthly
and span full years.
It is at best a crude way to normalize the results since the number of news sources
(and, hence, articles) changes over time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
news_search("data breach", date_from="2014-01-01", date_to="2014-12-31")
## date_from date_to year month_abb month count search_date search_terms pct
## 1 2014-01-01 2014-01-31 2014 Jan 01 3963 2015-02-02 data breach 0.12539155
## 2 2014-02-01 2014-02-28 2014 Feb 02 2856 2015-02-02 data breach 0.09036545
## 3 2014-03-01 2014-03-31 2014 Mar 03 2589 2015-02-02 data breach 0.08191742
## 4 2014-04-01 2014-04-30 2014 Apr 04 2170 2015-02-02 data breach 0.06866002
## 5 2014-05-01 2014-05-31 2014 May 05 2680 2015-02-02 data breach 0.08479671
## 6 2014-06-01 2014-06-30 2014 Jun 06 1973 2015-02-02 data breach 0.06242683
## 7 2014-07-01 2014-07-31 2014 Jul 07 1962 2015-02-02 data breach 0.06207879
## 8 2014-08-01 2014-08-31 2014 Aug 08 2585 2015-02-02 data breach 0.08179086
## 9 2014-09-01 2014-09-30 2014 Sep 09 3326 2015-02-02 data breach 0.10523651
## 10 2014-10-01 2014-10-31 2014 Oct 10 2862 2015-02-02 data breach 0.09055529
## 11 2014-11-01 2014-11-30 2014 Nov 11 2473 2015-02-02 data breach 0.07824711
## 12 2014-12-01 2014-12-31 2014 Dec 12 2166 2015-02-02 data breach 0.06853346
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.