Convert Between Frequency Spectra and Type Frequency Lists (zipfR)

Share:

Description

tfl2spc computes an observed frequency spectrum from a type frequency list, while spc2tfl reconstructs the type frequency list underlying a frequency spectrum (but without type representations).

Usage

1
2
3

Arguments

tfl

an object of class tfl, representing a type frequency list

spc

an object of class spc, representing a frequency spectrum

Details

The current implementation of these functions does not support incomplete type frequency lists and frequency spectra.

spc2tfl can only convert frequency spectra where all class sizes are integers. For this reason, expected frequency spectra (including all spectra with variance data) are not supported.

Value

For tfl2spc, an object of class spc representing the frequency spectrum corresponding to the type frequency list tfl.

For spc2tfl, an object of class tfl representing type frequency list underlying the observed frequency spectrum tfl.

See Also

spc for more information about spc objects and links to relevant functions; tfl for more information about tfl objects and links to relevant functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Brown tfl and spc
data(Brown.tfl)
data(Brown.spc)


## a spectrum from a tfl
Brown.spc2 <- tfl2spc(Brown.tfl)

## identical to Brown.spc:
summary(Brown.spc)
summary(Brown.spc2)

tail(Brown.spc)
tail(Brown.spc2)


## a tfl from a spectrum
Brown.tfl2 <- spc2tfl(Brown.spc)

## same frequency information as Brown.tfl
## but with different ids and no type labels
summary(Brown.tfl)
summary(Brown.tfl2)

print(Brown.tfl2)
print(Brown.tfl)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.