stream (version 1.2-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 a subclass of DSD which implements a reset function.
pos
Position in the stream (the beginning of the stream is position 1).

Details

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

See Also

DSD_ReadCSV, DSD_MG, DSD_ScaleStream, DSD_Memory

Examples

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

p <- get_points(replayer, 50)
replayer

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

Run the code above in your browser using DataCamp Workspace