Learn R Programming

stream (version 2.0-1)

reset_stream: Reset a Data Stream to its Beginning

Description

Resets the position in a DSD object to the beginning or, if available, 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).

Author

Michael Hahsler

Details

Resets the counter of the stream object. For example, for DSD_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.

reset_stream() is implemented for:

  • DSD

  • DSD_MG

  • DSD_Memory

  • DSD_ReadStream

  • DSF

  • DSF_Convolve

See Also

Other DSD: DSD_BarsAndGaussians(), DSD_Benchmark(), DSD_Cubes(), DSD_Gaussians(), DSD_MG(), DSD_Memory(), DSD_Mixture(), DSD_NULL(), DSD_ReadDB(), DSD_ReadStream(), DSD_Target(), DSD_UniformNoise(), DSD_mlbenchData(), DSD_mlbenchGenerator(), DSD(), DSF(), animate_data(), close_stream(), get_points(), plot.DSD()

Examples

Run this code
# initializing the objects
stream <- DSD_Gaussians()
replayer <- DSD_Memory(stream, 100)
replayer

p <- get_points(replayer, 50)
replayer

# reset replayer to the beginning 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 DataLab