calcLOI: Calculate the appropriate LOI value for each observation

Description Usage Arguments Value Author(s) Examples

View source: R/lmafunctions.r

Description

This function receives a matrix containing the X,Y,Weight,FX,FY columns, after the calcWeights and the reduceSameXs function has been used on it and calculates the LOI column

Usage

1
calcLOI(mat)

Arguments

mat

A matrix containing the X,Y,Weight,FX,FY columns, after the calcWeights and the reduceSameXs function has been used on it

Value

A matrix with the newely added LOI column

Author(s)

Tal Carmi, Liat Gaziel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
d <- c(1,1,3,4)
e <- c(5,6,7,8)
f <- c(1,1,1,1)
mydata <- data.frame(d,e,f)
names(mydata) <- c("X","Y","Weight")
mydata<-calcWeights(mydata)
mydata<-averageSameXs(mydata)
mydata<-calcFX(mydata)
mydata<-calcFY(mydata)
calcLOI(mydata)

## The function is currently defined as
function (mat) 
{
    n <- size(mat)
    for (i in 1:n) {
        mat[i, 6] = mat[i, 4] * mat[n, 5]
    }
    names(mat)[6] = "LOI"
    return(mat)
  }

ACCLMA documentation built on May 2, 2019, 8:49 a.m.