Skip to contents

Gets points from a DSD object.

Usage

get_points(x, ...)

# S3 method for class 'DSD'
get_points(x, n = 1L, info = TRUE, ...)

remove_info(points)

Arguments

x

A DSD object.

...

Additional parameters to pass to the get_points() implementations.

n

integer; request up to n points from the stream. n = -1 returns all remaining points from limited streams.

info

return additional columns with information about the data point (e.g., a known cluster assignment).

points

a data.frame with points.

Value

Returns a data.frame with (up to) n rows and as many columns as x produces.

Details

Each DSD object has a unique way for creating/returning data points, but they all are called through the generic function, get_points(). This is done by using the S3 class system. See the man page for the specific DSD class on the semantics for each implementation of get_points().

Additional Point Information

Additional point information (e.g., known cluster/class assignment, noise status) can be requested with info = TRUE. This information is returned as additional columns. The column names start with . and are ignored by DST implementations. remove_info() is a convenience function to remove the information columns. Examples are

  • .id for point IDs

  • .class for known cluster/class labels used for plotting and evaluation

  • .time a time stamp for the point (can be in seconds or an index for ordering)

Resetting a Stream

Many streams can be reset using reset_stream().

Author

Michael Hahsler

Examples

stream <- DSD_Gaussians()
points <- get_points(stream, n = 5)
points
#>          X1         X2 .class
#> 1 0.1577454 0.07619712      3
#> 2 0.4329033 0.18742456      2
#> 3 0.4046012 0.27845186      2
#> 4 0.4261061 0.32014826      2
#> 5 0.4187696 0.43680434      2

remove_info(points)
#>          X1         X2
#> 1 0.1577454 0.07619712
#> 2 0.4329033 0.18742456
#> 3 0.4046012 0.27845186
#> 4 0.4261061 0.32014826
#> 5 0.4187696 0.43680434