[R] Population model question

Chris Stubben
Tue, 15 Jan 2008 22:02:22 -0000

-Halcyon- wrote:
>
> My question is : How do I arbitrarily assign the animals being
"FALSE"
> ***according to the uniformal chance generation*** to the array
> Dead.Animals, there being "TRUE"?
>

Maybe I'm missing something, but aren't dead animals just the ones that
aren't alive?  Why do you even need the Dead.Animals array if you filled
Live.Animals correctly?

## 4 animals in cohort and 3 years
Live.Animals<-matrix(c(T,T,F, T,T,T, T,T,F, F,F,F), nrow=4, byrow=TRUE)
 Live.Animals
      [,1]  [,2]  [,3]
[1,]  TRUE  TRUE FALSE
[2,]  TRUE  TRUE  TRUE
[3,]  TRUE  TRUE FALSE
[4,] FALSE FALSE FALSE

# Dead animals are NOT Live.Animals?

!Live.Animals
      [,1]  [,2]  [,3]
[1,] FALSE FALSE  TRUE
[2,] FALSE FALSE FALSE
[3,] FALSE FALSE  TRUE
[4,]  TRUE  TRUE  TRUE

# or maybe use rowSums to find dead animals
dead<- which(rowSums(Live.Animals) < 3)
[1] 1 3 4

Chris
--
View this message in context:
http://www.nabble.com/Population-model-question-tp14833982p14848821.html
Sent from the R help mailing list archive at Nabble.com.