Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. require(plotly)
  2. require(dplyr)
  3.  
  4. randomData <- sample.int(100000, 100, replace = TRUE)
  5. sortedRandomData <- sort(randomData)
  6. data.frame(a = sortedRandomData) %>%
  7. plotly::plot_ly(name = "firstPlot") %>%
  8. plotly::add_trace(y = ~a,type = 'scatter',mode = 'markers')
  9.  
  10. ma <- function(x, n = 80){stats::filter(x, rep(1 / n, n), sides = 2)}
  11.  
  12. movedAverageData <- ma(sortedRandomData)
  13. data.frame(b = movedAverageData) %>%
  14. plotly::plot_ly(name = "secondPlot") %>%
  15. plotly::add_trace(y = ~b,type = 'scatter',mode = 'markers')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement