warmth: Warmth Detector

View source: R/warmth.R

warmthR Documentation

Warmth Detector

Description

Assesses warmth perceptions in self-presentational natural language. This function is one of the main two functions of the warmthcompetence package. It takes an N-length vector of self-presentational text documents and N-length vector of document IDs and returns a warmth perception score that represents how much warmth others attribute the individual who wrote the self-presentational text. The function also contains a metrics argument that enables users to also return the raw features used to assess warmth perceptions.

Usage

warmth(text, ID = NULL, metrics = "scores")

Arguments

text

character A vector of texts, each of which will be assessed for warmth.

ID

character A vector of IDs that will be used to identify the warmth scores.

metrics

character An argument that allows users to decide what metrics to return. Users can return the warmth scores (metrics = "scores"), the features that underlie the warmth scores (metrics = "features"), or both the warmth scores and the features (metrics = "all). The default choice is to return the warmth scores.

Details

Some features depend Spacyr which must be installed separately in Python.

Value

The default is to return a data.frame with each row containing the document identifier and the warmth score. Users can also customize what is returned through the metrics argument. If metrics = "features", then a dataframe of warmth features will be returned where each document is represented by a row. If metrics = "all", then both the warmth scores and features will be returned in a data.frame.

References

Benoit K, Watanabe K, Wang H, Nulty P, Obeng A, Müller S, Matsuo A (2018). “quanteda: An R package for the quantitative analysis of textual data.” Journal of Open Source Software, 3(30), 774. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.21105/joss.00774")}, https://quanteda.io. Buchanan, E. M., Valentine, K. D., & Maxwell, N. P. (2018). LAB: Linguistic Annotated Bibliography - Shiny Application. Retrieved from http://aggieerin.com/shiny/lab_table. Rinker, T. W. (2018). lexicon: Lexicon Data version 1.2.1. http://github.com/trinker/lexicon Rinker, T. W. (2019). sentimentr: Calculate Text Polarity Sentiment version 2.7.1. http://github.com/trinker/sentimentr Yeomans, M., Kantor, A. & Tingley, D. (2018). Detecting Politeness in Natural Language. The R Journal, 10(2), 489-502.

Examples

data("example_data")

warmth_scores <- warmth(example_data$bio, metrics = "all")

example_data$warmth_predictions <- warmth_scores$warmth_predictions
warmth_model1 <- lm(RA_warm_AVG  ~ warmth_predictions, data = example_data)
summary(warmth_model1)



bushraguenoun/warmthcompetence documentation built on July 27, 2024, 6:21 a.m.