[R] How to access values in s4 method
David Winsemius
dwinsemius at comcast.net
Thu Oct 21 20:49:53 CEST 2010
On Oct 21, 2010, at 8:05 PM, Fahim Md wrote:
> Hi
> How to access the values in the output that is an object of S4 type.
> I tried
> to access using subset ( [ ] ) but it is not allowed.
> Any clue??
>
> Thanks
> -- Fahim
>
>
>
> #My code is as follows:
> require(IRanges);
> query <- IRanges(c(1, 4, 9), c(5, 7, 10))
> subject <- IRanges(c(2, 2, 10), c(2, 3, 12))
> findOverlaps(query, subject)
>
>
> Output of find overlap function is:
> ------------------
> 1> findOverlaps(query, tree)
> An object of class "RangesMatching"
> Slot "matchMatrix":
> query subject
> [1,] 1 1
> [2,] 1 2
> [3,] 3 2
>
> Slot "DIM":
> [1] 4 3
> --------------------
>
> How to access the values in the output?
> ?"RangesMatching-class" # to determine accessor functions
> ovrl <- findOverlaps(query, subject)
> as.table(ovrl)
[1] 2 0 1
> ? findOverlaps
> as.matrix(ovrl)
query subject
[1,] 1 1
[2,] 1 2
[3,] 3 3
> dim(ovrl)
[1] 3 3
>
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list