create_dfm: Create a document-feature matrix

Description Usage Arguments Value Examples

View source: R/term_selection.R

Description

Given a character vector of document information, creates a document-feature matrix.

Usage

1
create_dfm(elements, features)

Arguments

elements

a character vector of document information (e.g. document titles or abstracts)

features

a character vector of terms to use as document features (e.g. keywords)

Value

a matrix with documents as rows and terms as columns

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dfm <- create_dfm(
  elements = c(
    "Cross-scale occupancy dynamics of a postfire specialist
    in response to variation across a fire regime",
    "Variation in home-range size of Black-backed Woodpeckers",
    "Black-backed woodpecker occupancy in burned and beetle-killed forests"
  ),
  features = c("occupancy", "variation", "black-backed woodpecker", "burn")
)

as.matrix(dfm)

elizagrames/litsearchr documentation built on April 14, 2021, 3:42 p.m.