Last data update: 2014.03.03

R: Calculates the appropriate LMA values for each observation
calcLMAR Documentation

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

A matrix containing the newely added LMA column

Author(s)

Tal Carmi, Liat Gaziel

Examples

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)
  }

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ACCLMA)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ACCLMA/calcLMA.Rd_%03d_medium.png", width=480, height=480)
> ### Name: calcLMA
> ### Title: Calculates the appropriate LMA values for each observation
> ### Aliases: calcLMA
> ### Keywords: ~kwd1 ~kwd2
> 
> ### ** Examples
> 
> 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)
  X   Y Weights   FX   FY   LOI   LMA
1 1 5.5    0.50 0.50 2.75 3.250 0.500
2 3 7.0    0.25 0.75 4.50 4.875 0.375
3 4 8.0    0.25 1.00 6.50 6.500 0.000
> 
> ## 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)
+   }
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)
}
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>