Last data update: 2014.03.03

R: Create Vector of Spectrum Elements (zipfR)
spc.vectorR Documentation

Create Vector of Spectrum Elements (zipfR)

Description

spc.vector returns a selected range of elements from a frequency spectrum as a plain numeric vector (which may contain entries with V_m = 0, unlike the spc object itself).

Usage


  spc.vector(obj, m.min=1, m.max=15, all=FALSE)

Arguments

obj

an object of class spc, representing an observed or expected frequency spectrum

m.min, m.max

determine the range of frequency classes to be returned (defaulting to 1 ... 15)

all

if TRUE, a vector containing the entire frequency spectrum is returned, i.e. m.max is set to max(obj$m). Note that the value of m.min can still be overridden manually to return only part of the spectrum.

Details

spc.vector(obj, a, b) is fully equivalent to Vm(obj, a:b) (and is implemented in this way).

Value

A numeric vector with the selected elements of the frequency spectrum. In this vector, empty frequency classes (V_m = 0) are represented by 0 entries (unlike the spc object, which omits all empty classes).

See Also

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

Vm.spc for an alternative way of extracting spectrum vectors from a .spc object, and N.spc, V.spc, VV.spc, VVm.spc for extracting related information

Examples


## Brown Noun spectrum
data(BrownNoun.spc)

## by default, extract first 15 elements
spc.vector(BrownNoun.spc)

## first five elements
spc.vector(BrownNoun.spc,1,5)

## just frequencies of spc elements 4 and 5 
spc.vector(BrownNoun.spc,4,5)
## same as
Vm(BrownNoun.spc,4:5)

Results