This is an R Package with libraries and utility functions for computational text analysis for the social sciences.

The functions are optimized for working with various kinds of text matrices. Focusing on the text matrix as the primary object – which is represented either as a base R dense matrix or a Matrix package sparse matrix – allows for a consistent and intuitive interface that stays close to the underlying mathematical foundation of computational text analysis. In particular, the package includes functions for working with word embeddings, text networks, and document-term matrices.

Related text datasets are available on GitLab in text2map.corpora and text dictionaries are available in text2map.dictionaries.

### Installation

Install the CRAN version:

install.packages("text2map")

Or install the latest development version from GitLab:

library(remote)
install_gitlab("culturalcartography/text2map")

Get started with "Concept Mover’s Distance by reading:

vignette("CMDist-concept-movers-distance", package = "text2map")

There are three related packages in development, and hosted on GitLab:

• text2map.corpora: collection of text datasets
• text2map.dictionaries: collection of dictionaries, currently:
• Sensorimotor Norms Dictionary for English, N = 40,000 (Lynott, et al. 2020)
• Concreteness Dictionary for English, N = 40,000 (Brysbaert et al. 2014)
• NRC Valence, Arousal, and Dominance Dictionary for English (Mohammad et al. 2018)
• text2map.theme: changes ggplot2 aesthetics and loads viridis color scheme

The above packages can be installed using the following:

library(remote)
install_gitlab("culturalcartography/text2map.theme")
install_gitlab("culturalcartography/text2map.corpora")
install_gitlab("culturalcartography/text2map.dictionaries")