data manipulation within unmarkedFrameOccu

171 views
Skip to first unread message

Hugh Robinson

unread,
Dec 2, 2013, 12:21:30 PM12/2/13
to unma...@googlegroups.com
Hi all,
Is there anyway to subset the data once it is entered as an unmarked frame or do I have to do it beforehand?  For example if I want to restrict my occupancy analysis to those rows where a dummy coded covariate West = 0, as a data frame this would work >wap_umf [wap_umf$West !=0, ] but not for an S4 class.

Thanks,
HR

Richard Chandler

unread,
Dec 2, 2013, 4:49:01 PM12/2/13
to Unmarked package
You should be able to use (most) standard indexing methods on an unmarkedFrame object. My guess is that you want something like:

umf[siteCovs(umf)$West != 0,]

or 

umf[which(siteCovs(umf)$West != 0),]




--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Richard Chandler
Assistant Professor
Warnell School of Forestry and Natural Resources
University of Georgia

Hugh Robinson

unread,
Dec 3, 2013, 12:02:49 PM12/3/13
to unma...@googlegroups.com
Thanks Richard,
Still being told that the UMF is not subsettable (error below).  I think I may need to define the operators myself first?

> wap_umf[siteCovs(wap_umf)$West!=0, ]
Error in wap_umf[siteCovs(wap_umf)$West != 0, ] :
  object of type 'S4' is not subsettable

Richard Chandler

unread,
Dec 3, 2013, 6:11:09 PM12/3/13
to Unmarked package
Looks like we never wrote the method for logical indexing, but the other methods work:

> umf <- unmarkedFrameOccu(y=matrix(1:9,3))
> umf[c(1,3),]
Data frame representation of unmarkedFrame object.
  y.1 y.2 y.3
1   1   4   7
2   3   6   9
> umf[c(TRUE,FALSE,TRUE),]
Error in umf[c(TRUE, FALSE, TRUE), ] : 
  object of type 'S4' is not subsettable
> umf[which(c(TRUE,FALSE,TRUE)),]
Data frame representation of unmarkedFrame object.
  y.1 y.2 y.3
1   1   4   7
2   3   6   9



--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hugh Robinson

unread,
Dec 4, 2013, 12:37:27 PM12/4/13
to unma...@googlegroups.com

Thanks Richard.

Subset_UMF<-Original_UMF[which(siteCovs(Original_UMF)$West !=0, )]
(fm.nullwest<-occu(~1 ~1, Subset_UMF))

Works like a charm.

Thanks again.
HR



On Monday, December 2, 2013 12:21:30 PM UTC-5, Hugh Robinson wrote:
Reply all
Reply to author
Forward
0 new messages