word_cloud.cranly_network {cranly}R Documentation

wordcloud of author names, package descriptions, and package titles

Description

wordcloud of author names, package descriptions, and package titles

Usage

## S3 method for class 'cranly_network'
word_cloud(
  x,
  package = Inf,
  author = Inf,
  maintainer = Inf,
  base = TRUE,
  recommended = TRUE,
  exact = TRUE,
  perspective = "description",
  random_order = FALSE,
  ignore_words = c("www.jstor.org", "www.arxiv.org", "arxiv.org", "provides", "https"),
  stem = FALSE,
  colors = rev(colorspace::heat_hcl(10)),
  ...
)

## S3 method for class 'numeric'
word_cloud(
  x,
  random_order = FALSE,
  colors = rev(colorspace::heat_hcl(10)),
  ...
)

Arguments

x

either a cranly_network object or a named vector of term frequencies (typically the output of compute_term_frequency() with frequency = "term".

package

a vector of character strings with the package names to be matched. Default is Inf which returns all available packages in x for further subsetting.

author

a vector of character strings with the author names to be matched. Default is Inf which returns all available author in x for further subsetting.

maintainer

a vector of character strings with the maintainer names to be matched. Default is Inf which returns all available maintainers in x for further subsetting.

base

logical. Should we include base packages in the subset? Default is TRUE.

recommended

logical. Should we include recommended packages in the subset? Default is TRUE.

exact

logical. Should we use exact matching? Default is TRUE.

perspective

should the wordcloud be that of package descriptions (perspective = "description"; default), of package titles (perspective = "title") or of author names (perspective = "author").

random_order

should words be plotted in random order? If FALSE (default) words are plotted in decreasing frequency.

ignore_words

a vector of words to be ignored when forming the corpus.

stem

should words be stemmed using Porter's stemming algorithm? Default is FALSE. See tm::stemDocument().

colors

color words from least to most frequent

...

other arguments to be passed to wordcloud::wordcloud (except random.order which is already defined through random_order).

Details

When applied to cranly_network objects, word_cloud() subsets either according to author (using the intersection of the result of author_of() and author_with()) or according to package (using the intersection of the results of package_with() and package_by()).

For handling more complex queries, one can manually extract the #' term frequencies from a supplied vector of character strings (see compute_term_frequency()), and use word_cloud() on them. See the examples.

Value

A word cloud.

See Also

compute_term_frequency()

Examples


## Package directives network
cran_db <- clean_CRAN_db()
package_network <- build_network(cran_db)
## Descriptions of all packages in tidyverse
tidyverse <- imported_by(package_network, "tidyverse", exact = TRUE)
set.seed(123)
word_cloud(package_network, package = tidyverse, exact = TRUE, min.freq = 2)

## or by manually creating the term frequencies from descriptions
descriptions <- descriptions_of(package_network, tidyverse, exact = TRUE)
term_freq <- compute_term_frequency(descriptions)
set.seed(123)
word_cloud(term_freq, min.freq = 2)



[Package cranly version 0.6.0 Index]