[Bioc-devel] subset fails on a DataFrame with 0 cols

Hervé Pagès hpages at fhcrc.org
Wed Jul 30 05:46:08 CEST 2014


On 07/28/2014 07:52 PM, Michael Lawrence wrote:
> Thanks, should be fixed in devel S4Vectors.

Indeed. Thanks!

H.

>
>
> On Mon, Jul 28, 2014 at 6:46 PM, Hervé Pagès <hpages at fhcrc.org
> <mailto:hpages at fhcrc.org>> wrote:
>
>     Hi Michael,
>
>     Works if the DataFrame has columns:
>
>        library(IRanges)
>        DF1 <- DataFrame(aa=letters[1:4])
>        DF0 <- DF1[0]
>
>     Then:
>
>        > DF1
>        DataFrame with 4 rows and 1 column
>                   aa
>          <character>
>        1           a
>        2           b
>        3           c
>        4           d
>
>        > DF0
>        DataFrame with 4 rows and 0 columns
>
>        > subset(DF1, c(FALSE, TRUE))
>        DataFrame with 2 rows and 1 column
>                   aa
>          <character>
>        1           b
>        2           d
>
>     OK. But:
>
>        > subset(DF0, c(FALSE, TRUE))
>        Error in NSBS(i, x, exact = exact, upperBoundIsStrict =
>     !allow.append) :
>          subscript is a logical vector with out-of-bounds TRUE values
>
>     This currently causes subset() to fail on a GRanges object with no
>     metadata cols.
>
>     Thanks,
>     H.
>
>
>     --
>     Hervé Pagès
>
>     Program in Computational Biology
>     Division of Public Health Sciences
>     Fred Hutchinson Cancer Research Center
>     1100 Fairview Ave. N, M1-B514
>     P.O. Box 19024
>     Seattle, WA 98109-1024
>
>     E-mail: hpages at fhcrc.org <mailto:hpages at fhcrc.org>
>     Phone: (206) 667-5791 <tel:%28206%29%20667-5791>
>     Fax: (206) 667-1319 <tel:%28206%29%20667-1319>
>
>     _________________________________________________
>     Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org> mailing list
>     https://stat.ethz.ch/mailman/__listinfo/bioc-devel
>     <https://stat.ethz.ch/mailman/listinfo/bioc-devel>
>
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list