set.seed(123)
ch <- captdata
# traps that caught something
caught <- t(apply(ch, 2:3, sum))
# construct artificial nontarget data
# (positive for half the traps that caught nothing)
nontarget(ch) <- (1-caught) * (runif(500)>0.5)
head(caught)
head(nontarget(ch))
# the summary method recognises the 'nontarget' attribute
summary(ch)$nontarget
Run the code above in your browser using DataLab