Learn R Programming

preText (version 0.6.2)

scaling_comparison: Scaling Comparison.

Description

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

Usage

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

Run this code
# 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)
# }

Run the code above in your browser using DataLab