prepare_news: Prepare news data

Description Usage Arguments Value

View source: R/prepare_data.r

Description

Prepare news data

Usage

1
2
3
4
5
6
7
8
9
prepare_news(
  d,
  doc_col,
  date_col,
  text_cols,
  docvars = NULL,
  first_n_words = NA,
  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

rm_time

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

Value

A quanteda style DTM


maskedforreview/gtdnews documentation built on April 12, 2021, 11:53 a.m.