scaling_comparison: Scaling Comparison.

Description Usage Arguments Value Examples

View source: R/scaling_comparison.R

Description

Scale each dfm and return a list of distance matrices and scaled document positions.

Usage

1
2
3
4
5
6
7
scaling_comparison(
  dfm_object_list,
  dimensions = 2,
  distance_method = "cosine",
  verbose = TRUE,
  cores = 1
)

Arguments

dfm_object_list

A list of quanteda dfm objects returned in the '$dfm_list$ field of the output from the 'factorial_preprocessing()' function.

dimensions

The number of dimensions to be used by the multidimensional scaling algorithm. Defaults to 2.

distance_method

The method that should be used for calculating document distances. Defaults to "cosine".

verbose

Logical indicating whether more information should be printed to the screen to let the user know about progress. Defaults to TRUE.

cores

The number of cores to be used for parallelization (optional).

Value

A result list object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# *** This function is used automatically inside of the preText() function.
# load the package
library(preText)
# load in the data
data("UK_Manifestos")
# preprocess data
preprocessed_documents <- factorial_preprocessing(
    UK_Manifestos,
    use_ngrams = TRUE,
    infrequent_term_threshold = 0.02,
    verbose = TRUE)
# scale documents
scaling_results <- scaling_comparison(preprocessed_documents$dfm_list,
                                      dimensions = 2,
                                      distance_method = "cosine",
                                      verbose = TRUE)

## End(Not run)

matthewjdenny/preText documentation built on July 27, 2021, 1:18 a.m.