A Consumer-class to select records with fixed
probability, returning a yield of fixed size. Successive calls to
yield result in sampling of subsequent records in the stream,
until the stream is exhausted.
Usage
Downsample(probability=0.1, sampledSize=1e6, ...)
Arguments
probability
A numeric(1) between 0, 1 indicating the
probability with which a record should be retained.
...
Additional arguments, passed to the $new method of
the underlying reference class. Currently unused.
sampledSize
A integer(1) indicating the number of
records to return.
Methods
See Consumer Methods.
Internal Class Fields and Methods
Internal fields of this class are are described with, e.g.,
getRefClass("Downsample")$fields.
Internal methods of this class are described with
getRefClass("Downsample")$methods() and
getRefClass("Downsample")$help().
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Streamer)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Streamer/Downsample-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Downsample
> ### Title: Consumer class to down-sample data
> ### Aliases: Downsample Downsample-class
> ### Keywords: classes
>
> ### ** Examples
> showClass("Downsample")
Class "Downsample" [package "Streamer"]
Slots:
Name: .xData
Class: environment
Extends:
Class "Consumer", directly
Class "Streamer", by class "Consumer", distance 2
Class "envRefClass", by class "Consumer", distance 3
Class ".environment", by class "Consumer", distance 4
Class "refClass", by class "Consumer", distance 4
Class "environment", by class "Consumer", distance 5, with explicit coerce
Class "refObject", by class "Consumer", distance 5
>
>
>
>
> dev.off()
null device
1
>