if (require(dplyr)) {
library(dplyr)
stream <- DSD_Gaussians(k = 3, d = 3)
plot(stream, xlim = c(0, 1), ylim = c(0, 1))
# 1. Select only columns X1 and X2
# 2. filter points by X1 > .5 (Note that the info columns also need to be filtered!)
# 3. Add a sum columns
stream2 <- stream %>%
DSF_dplyr(select(X1, X2)) %>%
DSF_dplyr(filter(X1 > .5), info = TRUE) %>%
DSF_dplyr(mutate(Xsum = X1 + X2))
stream2
# Note: you get fewer points because of the filter operation.
get_points(stream2, n = 10)
plot(stream2, xlim = c(0, 1), ylim = c(0, 1))
}
Run the code above in your browser using DataLab