Introduction to rfastlowess

Overview

rfastlowess is a high-performance R package for LOWESS (Locally Weighted Scatterplot Smoothing) built on a Rust backend.

Full documentation: https://lowess.readthedocs.io/

Installation

# From R-universe (pre-built binaries, no Rust required)
install.packages("rfastlowess", repos = "https://thisisamirv.r-universe.dev")

Quick Start

Basic Smoothing

The package uses S3 classes to provide a user-friendly interface. Models and results can be inspected using print(). Results can also be visualized using plot().

library(rfastlowess)

# Generate example data
set.seed(42)
x <- seq(0, 10, length.out = 100)
y <- sin(x) + rnorm(100, sd = 0.3)

# Initialize model
model <- Lowess(fraction = 0.3)
print(model)
#> <Lowess Model>
#>   Fraction:          0.3 
#>   Iterations:        3 
#>   Weight Function:   tricube 
#>   Parallel:          TRUE

# Fit model
result <- model$fit(x, y)
print(result)
#> <LowessResult>
#>   Points:            100 
#>   Fraction Used:     0.3

# Quick visualization using the S3 plot method
plot(result, main = "Auto-plot of LowessResult")


# For custom plotting, access components directly
plot(x, y, pch = 16, col = "gray", main = "Manual Overlay")
lines(result$x, result$y, col = "red", lwd = 2)

Robust Smoothing with Intervals

# Add outliers
y_outliers <- y
y_outliers[sample(1:100, 10)] <- y_outliers[sample(1:100, 10)] + 5

# Robust smoothing with confidence intervals
result_robust <- Lowess(
    fraction = 0.3,
    iterations = 5,
    confidence_intervals = 0.95
)$fit(x, y_outliers)

# Plot
plot(x, y_outliers, pch = 16, col = "gray", main = "Robust LOWESS")
lines(result_robust$x, result_robust$y, col = "red", lwd = 2)
lines(result_robust$x, result_robust$confidence_lower, col = "blue", lty = 2)
lines(result_robust$x, result_robust$confidence_upper, col = "blue", lty = 2)

Main Classes

Class Use Case
Lowess Primary interface - batch processing
StreamingLowess Large datasets (>100K points)
OnlineLowess Real-time data streams

Learn More

For comprehensive documentation including:

  • Parameter selection guides
  • Streaming and online processing tutorials
  • Genomic data examples
  • Performance benchmarks

Visit: https://lowess.readthedocs.io/

Session Info

sessionInfo()
#> R version 4.6.0 (2026-04-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] rfastlowess_1.3.0 BiocStyle_2.41.0 
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.39       R6_2.6.1            fastmap_1.2.0      
#>  [4] xfun_0.57           maketools_1.3.2     cachem_1.1.0       
#>  [7] knitr_1.51          BiocGenerics_0.59.0 htmltools_0.5.9    
#> [10] generics_0.1.4      rmarkdown_2.31      buildtools_1.0.0   
#> [13] lifecycle_1.0.5     cli_3.6.6           sass_0.4.10        
#> [16] jquerylib_0.1.4     compiler_4.6.0      sys_3.4.3          
#> [19] tools_4.6.0         evaluate_1.0.5      bslib_0.10.0       
#> [22] yaml_2.3.12         BiocManager_1.30.27 jsonlite_2.0.0     
#> [25] rlang_1.2.0