Skip to content

data manipulation help

2 messages · roberto munguia, Dieter Menne

#
roberto munguia <munguiar <at> posgrado.ecologia.edu.mx> writes:
..
This should give you a starter

# create play data
cap = data.frame(matrix(rbinom(120,1,0.3),nrow=10))

firstthat<-function(x) which(x)[1] # stolen from Thomas Lumley

# Make your data logical; not really needed, but easier to understand
cap.log = cap==1
apply(cap.log,1,firstthat) # gives first captures

Dieter