[chronojump] Added the calculation of nRM



commit ab55b1f8c52f918c51ab57cccbc5748f8ef874be
Author: Xavier Padullés <x padulles gmail com>
Date:   Fri Oct 30 10:18:35 2015 +0100

    Added the calculation of nRM

 encoder/RM.R |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/encoder/RM.R b/encoder/RM.R
index 27c1751..d642859 100644
--- a/encoder/RM.R
+++ b/encoder/RM.R
@@ -1,11 +1,28 @@
-RMIndirect <- function(Q, nrep){
-        rm = c(0,0,0,0,0,0,0)
-        rm[1] = Q * (36 / (37 - nrep))                                    #brzycki
-        rm[2] = Q * (1 + 0.0333  *  nrep)                                 #Epley
-        rm[3] = (100 * Q) / (101.3 - 2.67123 * nrep)                      #lander   
-        rm[4] = Q * nrep^0.1                                              #lombardi
-        rm[5] = (100 * Q) / (52.2 + (41.9 * exp(-0.055 * nrep)))          #mayhew
-        rm[6] = Q * (1 + 0.025 * nrep)                                    #oconner
-        rm[7] = (100 * Q) / (48.8 + (53.8 * exp(-0.075 * nrep)))          #wathan
+ 
+RMIndirect <- function(Q, nrep, n){
+#Q = load in Kg
+#nrep = number of maximum repetitions
+#n = the number of nRM you want to know
+
+        rm = matrix(rep(c(0,0,0,0,0,0,0), n), ncol=7)
+        colnames(rm) = c("Brzycki", "Epley", "Lander", "Lombardi", "Mayhew", "Oconner", "Wathan")
+        rm = as.data.frame(rm)
+        rm[1,1] = Q * (36 / (37 - nrep))                                    #Brzycki
+        rm[1,2] = Q * (1 + 0.0333  *  nrep)                                 #Epley
+        rm[1,3] = (100 * Q) / (101.3 - 2.67123 * nrep)                      #Lander   
+        rm[1,4] = Q * nrep^0.1                                              #Lombardi
+        rm[1,5] = (100 * Q) / (52.2 + (41.9 * exp(-0.055 * nrep)))          #Mayhew
+        rm[1,6] = Q * (1 + 0.025 * nrep)                                    #O'Conner
+        rm[1,7] = (100 * Q) / (48.8 + (53.8 * exp(-0.075 * nrep)))          #Wathan
+        if(n==1) return(rm)
+        for(i in 2:n){
+                rm[i,1] = rm[1,1] * (37 - i) / 36                           #Brzycki
+                rm[i,2] = rm[1,2] / (1 + (i / 30))                          #Epley
+                rm[i,3] = rm[1,3] * (101.3 - 2.67123 * i) / 100             #Lander
+                rm[i,4] = rm[1,4] / (i ^ (1 / 10))                          #Lombardi
+                rm[i,5] = rm[1,5] * (52.2 + (41.9 * exp(-1 * (i * 0.055)))) / 100       #Mayhew
+                rm[i,6] = rm[1,6] / (1 + i * 0.025)                         #O'Conner
+                rm[i,7] = rm[1,7]* (48.8 + (53.8 * exp(-1 * (i * 0.075)))) / 100        #Wathan
+                }
         return(rm)
-}
\ No newline at end of file
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]