ankle.R 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # For loop to add 1.1m to all the data of AnkleLeft.y to determine real height.
  2. #for (j in 1:(nrow(DATA))) {
  3. # DATA$AnkleLeft.y + 1.1
  4. #}
  5. lowestLeft <- min(DATA$AnkleLeft.y)
  6. lowestRight <- min(DATA$AnkleRight.y)
  7. highestLeft <- max(DATA$AnkleLeft.y)
  8. highestRight <- max(DATA$AnkleRight.y)
  9. VerschilLeft <- (lowestLeft - highestLeft)
  10. VerschilRight <- (lowestRight - highestRight)
  11. plot(DATA$AnkleLeft.y,
  12. type = "l",
  13. ylab = "Hoogte...",
  14. col = ifelse(DATA$AnkleLeft.y > -1.1, "green", "red"),
  15. ylim = c(-1.15, -0.9)
  16. )
  17. par(new=TRUE)
  18. plot(DATA$AnkleRight.y,
  19. type = "p",
  20. ylab = "Hoogte",
  21. col = ifelse(DATA$AnkleRight.y > -1.1, "orange", "purple"),
  22. ylim = c(-1.15, 0)
  23. )
  24. #Calculates the mean height of AnkleLeft.y
  25. meanLine <- mean(DATA[patient$WALKING,]$AnkleLeft.y)
  26. #Creates vector which contains the values above the mean height (1e quarter)
  27. Q1 <- c()
  28. for(i in patient$WALKING){
  29. if (DATA[i,]$AnkleLeft.y > meanLine){
  30. Q1 <- c(Q1, DATA[i,]$AnkleLeft.y)
  31. }
  32. }
  33. #Gives the mean value of the first quarter
  34. meanQ1 <- mean(Q1)
  35. #Creates vector which containts the values under the mean height value (3e quarter)
  36. Q2 <- c()
  37. for(i in patient$WALKING){
  38. if(DATA[i,]$AnkleLeft.y < meanLine){
  39. Q2 <- c(Q2, DATA[i,]$AnkleLeft.y)
  40. }
  41. }
  42. #Gives the mean value of the third quarter
  43. meanQ2 <- mean(Q2)
  44. meanQ1
  45. meanQ2
  46. DifferenceAnkleLeft <- meanQ2 - meanQ1
  47. remove(i)
  48. #Creates Smoothline of the left ankle
  49. SmoothAnkleLeft <- smooth.spline(DATA[patient$WALKING,]$AnkleLeft.y, spar=0.35)
  50. lines(SmoothAnkleLeft)