knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(emitters)
stream <- ReadableStream$new(list("1", "2", "3", "4", "5")) %|>% map_stream(function(data) { as.numeric(data) }) stream$on("data", print)
stream <- ReadableStream$new(1:1000) %|>% filter_stream(function(data) { data > 500 }) stream$on("data", print)
stream <- ReadableStream$new(1:1000) %|>% reduce_stream( function(x, y) { sum(x, as.numeric(y)) }, base_value = 0 ) stream$on("data", print)
stream <- ReadableStream$new(list("ABC", "AB", "ABB")) %|>% split_stream("B") stream$on("data", print)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.