Loading and Saving Frequency Spectra (zipfR)
read.spc loads frequency spectrum from
write.spc saves frequency spectrum object in
1 2 3
character string specifying the pathname of a disk file.
Files with extension
a frequency spectrum, i.e.\ an object of class
A TAB-delimited text file with column headers but no row names
(suitable for reading with
read.delim). The file must contain
at least the following two columns:
frequency class m
number V_m of types in frequency class m (or expected class size E[V_m])
An optional column labelled
VVm can be used to specify
variances of expected class sizes (for a frequency spectrum derived
from a LNRE model or by binomial interpolation).
These columns may appear in any order in the text file. All other columns will be silently ignored.
If the filename
file ends in the extension
.gz, the disk file
will automatically be decompressed (
read.spc) and compressed (
.spc file format does not store the values of
VV explicitly. Therefore, incomplete frequency
spectra and expected spectra with variances cannot be fully
reconstructed from disk files. Saving such frequency spectra (or
loading a spectrum with variance data) will trigger corresponding
read.spc returns an object of class
spc (see the
spc manpage for details)
spc manpage for details on
import/export of other data structures.
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 27 28 29
## Not run: ## examples will not be run during package compilation ## since they would require accessing and writing to ## external files ## load Italian ultra- data ## and write corresponding spectrum to external text file data(ItaUltra.spc) write.spc(ItaUltra.spc,"ultra.spc") ## now ultra.spc is a text file with columns m and Vm ## we ready it back in New.spc <- read.spc("ultra.spc") ## same spectrum as ItaUltra.spc, compare: summary(New.spc) summary(ItaUltra.spc) ## DON'T do the following, incomplete spectrum will not be ## restored properly!!! zm <- lnre("zm",ItaUltra.spc) # estimate model zm.spc <- lnre.spc(zm,N(zm)) # incomplete spectrum from model write.spc(zm.spc,"var.spc") # warnings bad.spc <- read.spc("/Users/baroni/Desktop/var.spc") ## latter is DIFFERENT from zm.spc!!! ## End(Not run)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.