Last data update: 2014.03.03

R: Producer class to generate (numeric) sequences
SeqR Documentation

Producer class to generate (numeric) sequences

Description

A Producer-class to generate a sequence (possibly long) of numbers.

Usage

Seq(from = 1L, to=.Machine$integer.max, by = 1L, yieldSize=1L,
    ...)

Arguments

from

A starting value of any type (e.g., integer, numeric supported by base::seq.

to

An ending value, typically of the same type as from.

by

A value, typically of the same class as from, indicating the increment between successive numbers in the sequence. by = 0 can create an infinite stream.

yieldSize

A integer(1) indicating the length of the output sequence each time yield() is invoked.

...

Additional arguments passed to Producer.

Constructors

Use Seq to construct instances of this class.

Methods

See Producer Methods.

Internal Class Fields and Methods

Internal fields of this class are are described with getRefClass("Seq")$fields.

Internal methods of this class are described with getRefClass("Seq")$methods() and getRefClass("Seq")$help().

Author(s)

Martin Morgan mtmorgan@fhcrc.org

See Also

Stream

Examples

s <- Seq(1, 10, yieldSize=5)
while(length(y <- yield(s)))
    print(y)

Results


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/Seq-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Seq
> ### Title: Producer class to generate (numeric) sequences
> ### Aliases: Seq-class Seq
> ### Keywords: classes
> 
> ### ** Examples
> 
> s <- Seq(1, 10, yieldSize=5)
> while(length(y <- yield(s)))
+     print(y)
[1] 1 2 3 4 5
[1]  6  7  8  9 10
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>