NewsSource: NewsSource

Description Usage Arguments Examples

Description

This function reads in a text file of articles downloaded from the NewsStand database.

Usage

1
NewsSource(x, encoding = "UTF-8")

Arguments

x
encoding

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, encoding = "UTF-8") 
{
    content <- readLines(x)
    content <- content[1:(length(content) - 6)]
    content <- content[grep(".", content)]
    num <- cumsum(grepl("______________", content))
    content <- split(content, num)
    s <- tm::SimpleSource(encoding, length = length(content), 
        content = content, uri = x, reader = readNews, class = "NewsSource")
    s
  }

sjkiss/tm.newsstand documentation built on May 30, 2019, 12:05 a.m.