### create a data base with a table with 3 Gaussians
if(require("RSQLite")) {
library("RSQLite")
con <- dbConnect(RSQLite::SQLite(), ":memory:")
points <- get_points(DSD_Gaussians(k = 3, d = 2), n = 110)
head(points)
dbWriteTable(con, "Gaussians", points)
### prepare a query result set. Make sure that the additional information
### column starts with .
res <- dbSendQuery(con, "SELECT X1, X2, `.class` AS '.class' FROM Gaussians")
res
### create a stream interface to the result set
stream <- DSD_ReadDB(res, k = 3)
stream
### get points
get_points(stream, n = 5)
plot(stream, n = 100)
### close stream clears the query and disconnects the database
close_stream(stream)
}
Run the code above in your browser using DataLab