Description Usage Arguments Value Author(s) Examples
View source: R/gen_cocit_corpuslist.R
Generates a List of Corpus based on a group on the abstracts that were found.
1 | gen_cocit_corpuslist(groupsWithAbstracts, mode = "corpus")
|
groupsWithAbstracts |
A List containing Lists with abstracts and authornames |
mode |
The actual value in the result, possible values are corpus and abstract: "corpus" The Corpus of all abstracts "abstract" Just a the list of abstracts that are found Default is "corpus" |
A list of lists containing the specified structure by the mode variable
MFinst
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 33 34 35 36 37 38 39 40 41 42 43 | ##---- 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 (groupsWithAbstracts, mode = "corpus")
{
groupCount = length(unique(groupsWithAbstracts[, 1]))
abstractCount = length(groupsWithAbstracts[, 1])
result = list()
currentGroup = 1
currentGroupList = vector(mode = "character")
for (i in 1:abstractCount) {
if (groupsWithAbstracts[, 1][i] != currentGroup) {
if (mode == "corpus") {
result[[currentGroup]] = corpus_gen(currentGroupList,
lang = "english")
}
else if (mode == "abstract" || mode == "author") {
result[[currentGroup]] = currentGroupList
}
currentGroup = groupsWithAbstracts[, 1][i]
currentGroupList = vector(mode = "character")
}
if (!(mode == "author")) {
if (groupsWithAbstracts[, 4][i] != "") {
currentGroupList = append(currentGroupList, c(groupsWithAbstracts[,
2][i], groupsWithAbstracts[, 4][i]))
}
}
else {
currentGroupList = append(currentGroupList, groupsWithAbstracts[,
2][i])
}
}
if (mode == "corpus") {
result[[groupCount]] = corpus_gen(currentGroupList, lang = "english")
}
else if (mode == "abstract" || mode == "author") {
result[[groupCount]] = currentGroupList
}
return(result)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.