Writes points from a data stream DSD object to a file or a connection.
Usage
DST_WriteStream(file, append = FALSE, ...)
# S3 method for class 'DST_WriteStream'
close_stream(dsd, ...)Arguments
- file
A file name or a R connection to be written to.
- append
Append the data to an existing file.
- ...
further arguments are passed on to
write_stream(). Note thatcloseis alwaysFALSEand cannot be specified.- dsd
a
DSD_WriteStreamobject with an open connection.
Details
Note: header = TRUE is not supported for files. The header would be
added for every call for update.
See also
Other DST:
DSAggregate(),
DSC(),
DSClassifier(),
DSOutlier(),
DSRegressor(),
DST(),
DST_SlidingWindow(),
evaluate,
predict,
stream_pipeline,
update
Examples
set.seed(1500)
stream <- DSD_Gaussians(k = 3, d = 2)
writer <- DST_WriteStream(file = "data.txt", info = TRUE)
update(writer, stream, n = 2)
readLines("data.txt")
#> [1] "0.876254652435868,0.522936851845779,2"
#> [2] "0.812427512321428,0.262452294398377,1"
update(writer, stream, n = 3)
readLines("data.txt")
#> [1] "0.876254652435868,0.522936851845779,2"
#> [2] "0.812427512321428,0.262452294398377,1"
#> [3] "0.753271337087053,0.245009458201735,1"
#> [4] "0.858143359987905,0.568894154264572,2"
#> [5] "0.429813150521751,0.267543195698126,3"
# clean up
close_stream(writer)
file.remove("data.txt")
#> [1] TRUE