R/make.clem.R In LoopAnalyst: A Collection of Tools to Conduct Levins' Loop Analysis

Documented in make.clem

```make.clem <- function(CM, status=FALSE) {
# Make births matrix
CM.B <- CM
CM.B[CM.B<0] <- 0

# Make deaths matrix
CM.D <- (CM.B - CM)

CLEM <- clem.B

CLEM[is.na(CLEM)] <- " ? "
CLEM[CLEM == 1] <- " + "
CLEM[CLEM == -1] <- " - "
CLEM[CLEM == 0] <- " 0 "

clem.D[is.na(clem.D)] <- "?"
clem.D[clem.D == 1] <- "+"
clem.D[clem.D == -1] <- "-"
clem.D[clem.D == 0] <- "0"

N <- nrow(CLEM)
for (i in 1:N) {
if (is.na(clem.B[i,i])) {
CLEM[i,i] <- "?"
}
else if (clem.B[i,i] == 1) {
CLEM[i,i] <- "+"
}
else if (clem.B[i,i] == -1) {
CLEM[i,i] <- "-"
}
else if (clem.B[i,i] == 0) {
CLEM[i,i] <- "0"
}
CLEM[i,i] <- paste(clem.D[i,i],",",CLEM[i,i],sep="")
}

dimnames(CLEM)[[2]] <- paste(" ",dimnames(CLEM)[[2]]," ",sep="")

print(CLEM, quote=FALSE)

}
```

Try the LoopAnalyst package in your browser

Any scripts or data that you put into this service are public.

LoopAnalyst documentation built on Jan. 20, 2018, 9:16 a.m.