Incremental Samples from a Type Frequency List (zipfR)
Compute incremental random samples from a type frequency list (an
object of class tfl
).
sample.tfl(obj, N, force.list=FALSE)
obj |
an object of class |
N |
a vector of non-negative integers in increasing order, the sample sizes for which incremental samples will be generated |
force.list |
if |
The current implementation is reasonably efficient, but will be rather slow when applied to very large type frequency lists.
If N
is a single integer (and the force.list
flag is not
set), a tfl
object representing a random sample of size N
from the type frequency list obj
.
If N
is a vector of length greater one, or if
force.list=TRUE
, a list of tfl
objects representing
incremental random samples of the specified sizes N.
Incremental means that each sample is a superset of the
preceding sample.
tfl
for more information about type frequency lists
sample.spc
is an analogous function for frequency
spectra (objects of class spc
)
## load Brown tfl data(Brown.tfl) summary(Brown.tfl) ## sample a tfl of 100k tokens MiniBrown.tfl <- sample.tfl(Brown.tfl,1e+5) summary(MiniBrown.tfl) ## if we repat, we get a different sample MiniBrown.tfl <- sample.tfl(Brown.tfl,1e+5) summary(MiniBrown.tfl)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.