[chronojump] RM.R added AVG



commit beef28f67a9f2eb3370ad9ae8c323fc244be41b6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Nov 2 11:15:40 2015 +0100

    RM.R added AVG

 encoder/RM.R |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/encoder/RM.R b/encoder/RM.R
index f9b9ab0..caa96ff 100644
--- a/encoder/RM.R
+++ b/encoder/RM.R
@@ -4,8 +4,8 @@ RMIndirect <- function(Q, nrep, nRM) {
 #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 = matrix(rep(c(0,0,0,0,0,0,0,0), nRM), ncol=8)
+        colnames(rm) = c("Brzycki", "Epley", "Lander", "Lombardi", "Mayhew", "Oconner", "Wathan", "AVG")
         rm = as.data.frame(rm)
         rm[1,1] = Q * (36 / (37 - nrep))                                    #Brzycki
         rm[1,2] = Q * (1 + 0.0333  *  nrep)                                 #Epley
@@ -14,9 +14,10 @@ RMIndirect <- function(Q, nrep, nRM) {
         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
+       rm[1,8] = mean(as.numeric(rm[1,1:7]))
 
        if(nRM < 2) return(rm)
-        for(i in 2:nRM){
+        for(i in 2:nRM) {
                 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
@@ -24,6 +25,7 @@ RMIndirect <- function(Q, nrep, nRM) {
                 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
+               rm[i,8] = mean(as.numeric(rm[i,1:7]))
                 }
         return(rm)
 }


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