readNews: News Reader

Description Usage Arguments Details Examples

Description

Let's get this done.

Usage

1
readNews(elem, language, id)

Arguments

elem

Something

language

Another thing

id

Something else

Details

I hope this works

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
structure(function (elem, language, id) 
{
    function(elem, language, id) {
        author <- gsub("Author:", "", grep("^Author:", elem$content, 
            value = TRUE))
        title <- gsub("Title:", "", grep("^Title:", elem$content, 
            value = TRUE))
        section <- gsub("Section: ", "", grep("^Section: ", elem$content, 
            value = TRUE))
        datetimestamp <- strptime(gsub("Publication date: ", 
            "", grep("^Publication date:", elem$content, value = TRUE)), 
            format = "%b %d, %Y")
        origin <- gsub("Publication title:", "", grep("^Publication title:", 
            elem$content, value = TRUE))
        id <- as.numeric(gsub("ProQuest document ID: ", "", grep("^^ProQuest document ID:", 
            elem$content, value = TRUE)))
        content <- elem$content[grep("^Full [Tt]ext:", elem$content):grep("^Title", 
            elem$content) - 1]
        doc <- PlainTextDocument(x = gsub("Full Text: |Full text: ", 
            "", content), author = author, heading = title, id = id, 
            datetimestamp = datetimestamp, origin = origin)
        meta(doc, "Length") <- sum(sapply(gregexpr("\W+", doc), 
            length) + 1)
        meta(doc, "Section") <- section
        doc
    }
  }, class = c("FunctionGenerator", "function"))

sjkiss/tm.plugin.waterloo documentation built on May 30, 2019, 8:08 p.m.