sortByNRepeated: Make a list of common occurances sorted by number of repeats

View source: R/sortByNRepeated.R

sortByNRepeatedR Documentation

Make a list of common occurances sorted by number of repeats

Description

The aim of this function is to count the number of occurances of words when comaring separate vectors (x, y and z) or from a list (given as x) and to give an output sorted by their frequency. The output lists the various values/words by their frequency, the names of the resulting list-elements indicate number of times the values/words were found repeated.

Usage

sortByNRepeated(
  x,
  y = NULL,
  z = NULL,
  filterIntraRep = TRUE,
  silent = TRUE,
  debug = FALSE,
  callFrom = NULL
)

Arguments

x

(list, character or integer) main input, if list, arguments y and z will not be used

y

(character or integer) supplemental vector to comare with x

z

(character or integer) supplemental vector to comare with x

filterIntraRep

(logical) allow making vectors x, y and z unique before comparing (defaults to TRUE)

silent

(logical) suppress messages

debug

(logical) additional messages for debugging

callFrom

(character) allow easier tracking of messages produced

Details

In order to compare the frquency of values/words between separate vectors or vectors within a list, it is necessary that these have been made unique before calling this function or using filterIntraRep=TRUE.

In case the input is given as list (in x), there is no restriction to the number of vectors to be compared. With very long lists, however, the computational effort incerases (like it does when using table)

Value

This function returns a list sorted by number of occurances. The names of the list indicate the number of repeats.

See Also

table, replicateStructure

Examples

sortByNRepeated(x=LETTERS[1:11], y=LETTERS[3:13], z=LETTERS[6:12])
sortByNRepeated(x=LETTERS[1:11], y=LETTERS[c(3:13,5:4)], z=LETTERS[6:12])


wrMisc documentation built on Sept. 11, 2024, 6:10 p.m.