# NOT RUN {
### create a data base with a table with 3 Gaussians
library("RSQLite")
con <- dbConnect(RSQLite::SQLite(), ":memory:")
points <- get_points(DSD_Gaussians(k=3, d=2, outliers=1,
outlier_options=list(outlier_horizon=600)), 600,
class = TRUE, outlier = TRUE)
points <- cbind(points, outlier=attr(points,"outlier"))
head(points)
dbWriteTable(con, "gaussians", points)
### prepare a query result set
res <- dbSendQuery(con, "SELECT X1, X2, class, outlier FROM gaussians")
res
### create a stream interface to the result set
stream <- DSD_ReadDB(res, k=3, o=1, class = 3, outlier = 4)
### get points
get_points(stream, 5, class = TRUE, outlier=TRUE)
plot(stream)
### clean up
dbClearResult(res)
dbDisconnect(con)
# }
Run the code above in your browser using DataLab