Learn R Programming

ACCLMA (version 1.0)

calcLMA: Calculates the appropriate LMA values for each observation

Description

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

Usage

calcLMA(mat)

Arguments

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

Value

Details

References

See Also

Examples

Run this code
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)
mydata<-calcLOI(mydata)
calcLMA(mydata)

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

Run the code above in your browser using DataLab