Resets the position in a DSD object to the beginning or, if available, any other position in the stream.
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, 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:
See also
Other DSD:
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(),
DSF(),
animate_data(),
close_stream(),
get_points(),
plot.DSD()
Examples
# initializing the objects
stream <- DSD_Gaussians()
replayer <- DSD_Memory(stream, 100)
replayer
#> Memorized Stream for Gaussian Mixture (d = 2, k = 3)
#> Class: DSD_Memory, DSD_R, DSD
#> Contains 100 data points - currently at position 1 - loop is FALSE
p <- get_points(replayer, 50)
replayer
#> Memorized Stream for Gaussian Mixture (d = 2, k = 3)
#> Class: DSD_Memory, DSD_R, DSD
#> Contains 100 data points - currently at position 51 - loop is FALSE
# reset replayer to the beginning of the stream
reset_stream(replayer)
replayer
#> Memorized Stream for Gaussian Mixture (d = 2, k = 3)
#> Class: DSD_Memory, DSD_R, DSD
#> Contains 100 data points - currently at position 1 - loop is FALSE
# set replayer to position 21
reset_stream(replayer, pos = 21)
replayer
#> Memorized Stream for Gaussian Mixture (d = 2, k = 3)
#> Class: DSD_Memory, DSD_R, DSD
#> Contains 100 data points - currently at position 21 - loop is FALSE