Learn R Programming

shinyHugePlot (version 0.3.0)

LTTB_aggregator: Aggregation using Largest Triangle Three Buckets (LTTB) method.

Description

The LTTB method aggregates the huge samples using the areas of the triangles formed by the samples. Numerical distances are employed in this class, which requires the ratio between x and y values. When the x is datetime, nanosecond is a unit. When the x is factor or character, it will be encoded into numeric codes.

Arguments

Format

An R6::R6Class object

Super class

shinyHugePlot::aggregator -> LTTB_aggregator

Methods

Inherited methods


Method new()

Constructor of the aggregator.

Usage

LTTB_aggregator$new(
  ...,
  nt_y_ratio = 1e+09,
  x_y_ratio = 1,
  interleave_gaps,
  coef_gap,
  NA_position
)

Arguments

x_y_ratio, nt_y_ratio

Numeric. These parameters set the unit length of the numeric x and nanotime x. For example, setting x_y_ratio to 2 is equivalent to assuming 2 is the unit length of x (and 1 is always the unit length of y). The unit length is employed to calculate the area of the triangles.

interleave_gaps, coef_gap, NA_position, ...

Arguments pass to the constructor of aggregator object. Note that accepted_datatype has default value. Downsample with the Largest Triangle Three Buckets (LTTB) aggregation method


Method clone()

The objects of this class are cloneable with this method.

Usage

LTTB_aggregator$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code
data(noise_fluct)
agg <- LTTB_aggregator$new(interleave_gaps = TRUE)
d_agg <- agg$aggregate(
  x = noise_fluct$time, y = noise_fluct$f500, n_out = 1000
  )
plotly::plot_ly(x = d_agg$x, y = d_agg$y, type = "scatter", mode = "lines")

Run the code above in your browser using DataLab