2
0

head.R 843 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #color <- rainbow(length(STATE))
  2. color <- c("red", "blue", "blue", "green")
  3. #Plot graph
  4. plot(DATA$Head.y,
  5. type = "l",
  6. ylab = "Hoogte hoofd"
  7. )
  8. for(i in 1:nrow(DATA)){
  9. points(i, DATA[i,]$Head.y, col = color[DATA[i,]$state])
  10. }
  11. #Check if patient is walking straight enough
  12. differ_ <- 0.4
  13. start <- min(WALKING)
  14. stop <- max(WALKING)
  15. segments(start, WALKBASE, stop, col = "black")
  16. #base <- mean(c(DATA[start,]$Head.y, DATA[stop,]$Head.y))
  17. #size_ <- 5
  18. # for(i in seq(start, stop, size_)){
  19. #
  20. # step <- mean(DATA[i:(i+size_),]$Head.y) - base
  21. #
  22. # for(j in 0:(size_ -1)){
  23. # if(DATA[i+j,]$state != 1) next
  24. # points(i+j, DATA[i+j,]$Head.y - step, p = "*")
  25. # }
  26. #
  27. # }
  28. # http://stats.stackexchange.com/questions/30975/how-to-add-non-linear-trend-line-to-a-scatter-plot-in-r
  29. # http://www.mathsisfun.com/geometry/parabola.html