frequency: frequency

View source: R/Sherlock.R

frequencyR Documentation

frequency

Description

compute ratio of number of occurrences of query string divided by total number of words

Usage

frequency(texts.vec, starts, patterns)

Arguments

texts.vec

character vector of entire text

starts

integer vector of starting positions

patterns

vector of character string query patterns

Value

a list whose components are sub-lists

# indexed by the titles of the stories

  • start integer starting line in text

  • end integer ending line in text

  • wPerLine integer words perline

  • wordSum integer sum of wPerLine

  • patterns a sub-list

    • integer pPerLine integer patterns per line

    • patSum integer total of pPerLine

    • fraction numeric ratio of patSum/wordSum

Examples

fr<-frequency(texts.vec,starts,patterns)

SherlockHolmes documentation built on March 31, 2023, 5:47 p.m.