| LTTB_aggregator {shinyHugePlot} | R Documentation | 
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.
Format
An R6::R6Class object
Super class
shinyHugePlot::aggregator -> LTTB_aggregator
Methods
Public 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,
  accepted_datatype = c("numeric", "integer", "character", "factor", "logical")
)Arguments
- x_y_ratio, nt_y_ratio
- Numeric. These parameters set the unit length of the numeric - xand- nanotimex. For example, setting- x_y_ratioto 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, accepted_datatype, ...
- Arguments pass to the constructor of - aggregatorobject. Note that- accepted_datatypehas 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
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")