sumbis: Sum of vector elements

Description Usage Arguments Details Value Examples

View source: R/sumbis.R

Description

sumbis computes the sum of a vector

Usage

1
sumbis(v)

Arguments

v

Numeric vector

Details

sumbis computes the sum of a vector, to avoid some problems in comparison test due to R sum function.

This problem can also be avoided by using all.equal rather than all for example.

sumbis is used for compute global co-regulation coefficients in compute.B.from.beta.

Value

Numeric corresponding to the sum of all values present in the input vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  # Computation of co-regulation coefficients
#Number of enzymes
n <- 3
#Matrix of co-regulations (n column and n rows)
beta<-matrix(rep(0,n*n),nrow=n)
#Vector of global co-regulation coefficients (length n)
B <- rep(0,n)

#For each enzyme
for (j in 1:n){
  beta[j,j]<-1
}

#Set of co-regulation coefficients
beta[1,2]<- 0.1
beta[2,3]<- 2.0 #-0.43
beta[1,3]<- beta[1,2]*beta[2,3]
beta[2,1]<- 1/beta[1,2]
beta[3,1]<- 1/beta[1,3]
beta[3,2]<- 1/beta[2,3]

#Computation of global co-regulation coefficients
for (j in 1:n){
  B[j]<-sumbis(beta[j,])
}
#or
apply(beta,1,sumbis)

# result : B = c(1.3, 13.0,  6.5)

SimEvolEnzCons documentation built on Oct. 29, 2021, 1:07 a.m.