Skip to contents

filter rows of a hail Table

Usage

# S3 method for class 'hail.table.Table'
filter(.data, ..., .by = NULL, .preserve = FALSE)

Arguments

.data

instance of hail.table.Table

...

should include named components `filter` which is a logical vector with same number of rows as `.data`, `hl`, a reference to a hail environment (Module), and `placeholder` an arbitrary character(1)

.by

not used

.preserve

not used

Value

filtered hail.table.Table reference

Note

writes one line of table to disk to retrieve field names

FIXME: uses disk because I don't know how to create a BooleanExpression except by importing.

Examples

hl <- hail_init()
annopath <- path_1kg_annotations()
tab <- hl$import_table(annopath, impute = TRUE)$key_by("Sample")
pick <- rep(FALSE, 3500)
pick[seq_len(10)] <- TRUE
ft <- filter(tab, filter = pick, hl = hl)
ft$count()
#> [1] 10
ft$head(2L)$collect()
#> [[1]]
#> Struct(Sample='HG00096', Population='GBR', SuperPopulation='EUR', isFemale=False, PurpleHair=False, CaffeineConsumption=4, tmpf=True)
#> 
#> [[2]]
#> Struct(Sample='HG00097', Population='GBR', SuperPopulation='EUR', isFemale=True, PurpleHair=True, CaffeineConsumption=4, tmpf=True)
#>