Skip to content
Back to skills

Quanteda

ASecurity

R quanteda package for text analysis. Use for corpus management, tokenization, and document-feature matrices.

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 4, 2026
datago

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill quanteda --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Quanteda?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Quanteda
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-quanteda/badge)](https://www.skillsdirectory.com/skills/leolin990405-quanteda)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: quanteda
description: R quanteda package for text analysis. Use for corpus management, tokenization, and document-feature matrices.
---

# quanteda Package

Quantitative analysis of textual data.

## Corpus

```r
library(quanteda)

# Create corpus
corp <- corpus(texts)
corp <- corpus(df, text_field = "text")

# Metadata
docvars(corp, "author") <- authors
summary(corp)
```

## Tokenization

```r
# Tokenize
toks <- tokens(corp)

# Options
toks <- tokens(corp,
  remove_punct = TRUE,
  remove_numbers = TRUE,
  remove_symbols = TRUE
)

# N-grams
toks <- tokens_ngrams(toks, n = 2:3)

# Compound tokens
toks <- tokens_compound(toks, pattern = phrase(c("New York", "United States")))
```

## Document-Feature Matrix

```r
# Create DFM
dfm <- dfm(toks)

# Trim
dfm <- dfm_trim(dfm, min_termfreq = 5, min_docfreq = 2)

# Weight
dfm <- dfm_tfidf(dfm)

# Select features
dfm <- dfm_select(dfm, pattern = stopwords("en"), selection = "remove")
```

## Analysis

```r
# Top features
topfeatures(dfm, 20)

# Keyness
keyness <- textstat_keyness(dfm, target = docvars(dfm, "group") == "A")
textplot_keyness(keyness)

# Similarity
sim <- textstat_simil(dfm, method = "cosine")

# Frequency
freq <- textstat_frequency(dfm, groups = docvars(dfm, "group"))
```

## Dictionary

```r
# Create dictionary
dict <- dictionary(list(
  positive = c("good", "great", "excellent"),
  negative = c("bad", "poor", "terrible")
))

# Apply
dfm_dict <- dfm_lookup(dfm, dict)
```

## Visualization

```r
# Word cloud
textplot_wordcloud(dfm, max_words = 100)

# Network
fcm <- fcm(dfm)
textplot_network(fcm, min_freq = 50)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.