Learn R Programming

LLMing

The goal of LLMing is to generate and assess psychological text data.

Installation

You can install the development version of LLMing from GitHub with:

# install.packages("pak")
pak::pak("sliplr19/LLMing")

Example

This is a basic example which shows you how to get BERT embeddings:

library(LLMing)
#> 
#> Attaching package: 'LLMing'
#> The following object is masked from 'package:stats':
#> 
#>     embed

df <- data.frame(
  text = c(
    "I slept well and feel great today!",
    "I saw friends and it went well.",
    "I think I failed that exam. I'm such a disapointment."
  )
)

emb_dat <- embed(
  dat = df,
  layers = 1,
  keep_tokens = FALSE,
  tokens_method = "mean"
)
#> Using device: cpu
#> Processing batch 1/1
#> 
#> MPS for Mac available: False
#> Unable to use MPS (Mac M1+), CUDA (GPU), using CPU
#> Completed layers output for texts (variable: 1/1, duration: 0.783682 secs).
#> 
#> Completed layers aggregation for word_type_embeddings. 
#> 
#> Completed layers aggregation (variable 1/1, duration: 0.228859 secs).
#> 
#> Embedding single context embeddings.
#> 
#> Completed layers aggregation (variable 1/13, duration: 0.020877 secs).
#> 
#> Completed layers aggregation (variable 2/13, duration: 0.019911 secs).
#> 
#> Completed layers aggregation (variable 3/13, duration: 0.019728 secs).
#> 
#> Completed layers aggregation (variable 4/13, duration: 0.035636 secs).
#> 
#> Completed layers aggregation (variable 5/13, duration: 0.035478 secs).
#> 
#> Completed layers aggregation (variable 6/13, duration: 0.068546 secs).
#> 
#> Completed layers aggregation (variable 7/13, duration: 0.017823 secs).
#> 
#> Completed layers aggregation (variable 8/13, duration: 0.016648 secs).
#> 
#> Completed layers aggregation (variable 9/13, duration: 0.021572 secs).
#> 
#> Completed layers aggregation (variable 10/13, duration: 0.024744 secs).
#> 
#> Completed layers aggregation (variable 11/13, duration: 0.019792 secs).
#> 
#> Completed layers aggregation (variable 12/13, duration: 0.018830 secs).
#> 
#> Completed layers aggregation (variable 13/13, duration: 0.017301 secs).
#> 
#> Done! 
#> 
#> Minutes from start:  0.138
#> Estimated embedding time left = 0 minutes

Copy Link

Version

Install

install.packages('LLMing')

Monthly Downloads

237

Version

1.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Lindley Slipetz

Last Published

January 8th, 2026

Functions in LLMing (1.1.0)

embed

Embed texts with a Transformer model
pCOS

pCOS scores for every row of dataframe
rep_set

The vectors of the shared nearest neighbors
vector_SNN

Aggregate dataframe into mean feature vectors Aggregrate dataframe into mean feature vectors
text_datagen

Generate text data via Python LLM
normahalo

Local outlier score
textanomaly

Text anomaly score
LLMing-package

LLMing: Text Analysis Tools for Psychological Data
pCOS_row

Pairwise cosine-style row score
sim_SNN

Compute shared nearest neighbors
G_thres

Thresholding of pCOS dataframe
z_score

Z-score on columns