prepare_news: Prepare news data

Description Usage Arguments Value

View source: R/prepare_data.r

Description

Prepare news data

Usage

1
2
prepare_news(d, doc_col, date_col, text_cols, docvars = NULL,
  first_n_words = NA, with_geo = T, rm_time = T)

Arguments

d

A data.frame in which each row is a news article.

doc_col

The name of the column with unique article ids

date_col

The name of the column with the date, in a format that can be coerced to a Date object with as.Date()

text_cols

The name(s) of the column(s) with article text. e.g. c('headline','byline','body')

docvars

The columns to include as docvars (article meta such as headline, url)

first_n_words

Optionally, only include the first n words of the article text in the DTM

with_geo

IF TRUE, add geo tags to docvars (see vignette for usage)

rm_time

If TRUE, remove time related terms, such as monday, januari and yesterday.

Value

A quanteda style DTM


kasperwelbers/restecode documentation built on Feb. 12, 2020, 11:39 a.m.