Learn R Programming

stream (version 1.0-3)

reset_stream: Reset a Data Stream to its Beginning

Description

Resets the counter in a DSD object to the beginning or any other position in the stream.

Usage

reset_stream(dsd, pos = 1)

Arguments

dsd
An object of class DSD_ReadStream, DSD_Wrapper DSD_ScaleStream or DSD_MG.
pos
Position in the stream (the beginning of the stream is position 1).

Details

Resets the counter of the stream object. For DSD_ReadStream objects, this is done by calling seek() on the underlying connection. For DSD_Wrapper, the counter stored in the environment variable is moved back to 1.

See Also

DSD_ReadStream, DSD_MG, DSD_ScaleStream, DSD_Wrapper

Examples

Run this code
# initializing the objects
dsd <- DSD_Gaussians(k=3, d=2)
replayer <- DSD_Wrapper(dsd, 100)
replayer

p <- get_points(replayer, 50)
replayer

# resetting the dsd to the begining of the stream
reset_stream(replayer) 
replayer
  
# set the dsd to position 21
reset_stream(replayer, pos=21)  
replayer

Run the code above in your browser using DataLab