lnt_add: Adds or replaces articles

lnt_addR Documentation

Adds or replaces articles

Description

This functions adds a dataframe to a slot in an LNToutput object or overwrites existing entries. The main use of the function is to add an extract of one of the data.frames back to an LNToutput object after operations were performed on it.

Usage

lnt_add(to, what, where = "meta", replace = TRUE)

Arguments

to

an LNToutput object to which something should be added.

what

A data.frame which is added.

where

Either "meta", "articles" or "paragraphs" to indicate the slot to which data is added.

replace

If TRUE, will overwrite entries which have the same ID as

Details

Note, that when adding paragraphs, the Par_ID column is used to determine if entries are already present in the set. For the other data frames the article ID is used.

Author(s)

Johannes Gruber

Examples

# Make LNToutput object from sample
LNToutput <- lnt_read(lnt_sample(copy = FALSE))

# extract meta and make corrections
correction <- LNToutput@meta[grepl("Wikipedia", LNToutput@meta$Headline), ]
correction$Newspaper <- "Wikipedia"

# replace corrected meta information
LNToutput <- lnt_add(to = LNToutput, what = correction, where = "meta", replace = TRUE)

LexisNexisTools documentation built on July 9, 2023, 5:16 p.m.