# NOT RUN {
library(sparklyr)
library(sparklyr.flint)
sc <- try_spark_connect(master = "local")
if (!is.null(sc)) {
price_sdf <- copy_to(
sc,
data.frame(time = seq(1000), price = rnorm(1000))
)
ts <- fromSDF(price_sdf, is_sorted = TRUE, time_unit = "SECONDS")
ts_ema <- summarize_ema_half_life(
ts,
column = "price",
half_life_duration = "100s"
)
} else {
message("Unable to establish a Spark connection!")
}
# }
Run the code above in your browser using DataLab