datafest competition 2019
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
633 B

  1. fatigueFunction <- function(workLoad, index)
  2. {
  3. if(index == 1)
  4. {
  5. return(workLoad[1])
  6. }
  7. else
  8. {
  9. return(workLoad[index] + (exp(1)^(-1/15))**fatigueFunction(workLoad, index -1))
  10. }
  11. }
  12. smoothVector <- function(dataV)
  13. {
  14. dataNew <- c()
  15. for(i in 1:length(dataV))
  16. {
  17. dataNew <- c(dataNew, fatigueFunction(dataV, i))
  18. }
  19. dataNew
  20. }
  21. slidingWindowSmooth <- function(dataV, windowSize = 7)
  22. {
  23. dataNew <- c()
  24. for(i in 1:windowSize)
  25. {
  26. dataNew <- c(dataNew, mean(dataV[c(1:i)]))
  27. }
  28. for(i in (windowSize + 1):length(dataV))
  29. {
  30. dataNew <- c(dataNew, mean(dataV[(i-7):i]))
  31. }
  32. dataNew
  33. }