Description Usage Arguments Value Examples
Knowledge domain visualization, to perform a SCA of each partitioned document-term matrix
1 2 |
dtmGroup |
a document-term matrix |
graph |
a logical value, if TRUE a graph is displayed |
ex |
number identifying the factor to be used as horizontal axis (1 by default) |
ey |
number identifying the factor to be used as vertical axis (1 by default) |
ucal |
quality representation threshold (percentage) in the plane (0 by default) |
cex.row |
scale for row points and row labels (0.6 by default) |
cex.col |
scale for column points and column labels (0.7 by default) |
the SCA from a document-term matrix group
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ## Not run:
rm(list = ls())
library("KDViz")
risFile <- system.file("ScienceDirectRIS.ris", package = "KDViz") # Original data
myData <- ReadRIS(risFile, "bibDataRIS", saveRda = TRUE, saveCSV = FALSE) # RIS file to data object
bibData <- system.file("bibData.Rda", package = "KDViz")
load(bibData)
# Create a corpus from the bib data
corpus <- CorpusFromBibData(bibData = bibData, bibUnits = c("Keywords"),
controlList = "", stopwords = "", wordsToRemove = "")
dtm <- DTMFromCorpus(corpus, row.names(bibData)) # Create a doc-term matrix from the corpus
dim(dtm)
# A first review of the raw corpus
bibUnits <- c("Keywords") # Selection of bibliometric units to analyze
controlList <- c("stripWhitespace", "removeNumbers") # List of tm process to perform
# Decide which stopwords are going to be used (a file or FALSE if they are not required)
stopwords <- FALSE
#stopwords <- system.file("stopwords_en.txt", package = "KDViz") # Optional
wordsToRemove <- c("nanotechnology") # List of custom words to remove
# Custom dictionary to replace some selected words
replaceWords <- system.file("keywordReplace.txt", package = "KDViz")
# Corpus from bibdata with and a control list to perform the entire tm process
corpus <- CorpusFromBibData(bibData = bibData, bibUnits = bibUnits,
controlList = controlList, stopwords = stopwords,
wordsToRemove = wordsToRemove, replaceWords = replaceWords)
termFreqTable <- TermFrequency(corpus) # See the frequency of terms in the corpus
head(termFreqTable, 98)
# Search for words containing the term in 'word' parameter
TermFreqByWord(termFreqTable = termFreqTable, word = "reduction")
# An optional function (contained yet in the previous process) to
# replace other words after getting a corpus
#corpus <- ReplaceByList(corpus = corpus, wordsFile = replaceWords)
termFreqTable <- TermFrequency(corpus) # See the frequency of terms in the current corpus
head(termFreqTable, 100)
dtm <- DTMFromCorpus(corpus, row.names(bibData)) # Create a doc-term matrix from the corpus
dim(dtm)
rownames(dtm)
termFreq <- TermFrequency(dtm) # See the frequency of terms in the doc-term matrix
head(termFreq, 100)
mpaWords <- matriz.mpa.corpus(corpus, fmin = 5, cmin = 1) # mpa matrices from a corpus object
mpaWords$Palabras
# mpa method from the calculated objects in 'mpaWords'
classes <- mpa::mpa(mpaWords$Matriza, 10, mpaWords$Palabras)
classes
kdSummary <- KDSummary(matriz.mpa = mpaWords, mpa = classes) # a quick summary of the mpa process
mpa::plotmpa(3, mpaWords$Matriza, classes) # Plot the network of selected class
# Extract a partition of the original 'dtm' matrix depending on the class that you want
WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 7, graph = TRUE)
group1 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 1, graph = TRUE)
group2 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 2, graph = TRUE)
group3 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 3, graph = TRUE)
group4 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 4, graph = TRUE)
group5 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 5, graph = TRUE)
group6 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 6, graph = TRUE)
group7 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 7, graph = TRUE)
group8 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 8, graph = TRUE)
group9 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 9, graph = TRUE)
group10 <- WordGroupDTM(dtm, wordClasses = kdSummary$wordClasses, class = 10, graph = TRUE)
plot(group1$coaGroup, ucal = 0, cex.col = 0.8, cex.row = 0.5)
LoadArticle(bibData, "A625") # Load the info of an article (it will open the URL by default)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.