Require at least N occurrences of a query within a window
atLeast(
x,
query,
aperture = duringInterval(eventStarts(-Inf, Inf)),
distinct = NA,
countColumn = NA_character_
)Minimum integer count of required occurrences.
A Query object (e.g. from conditionOccurrence()).
An EventAperture built with duringInterval. Defaults to all time.
If TRUE, count distinct values of countColumn.
Column to use for distinct counting (e.g. "DOMAIN_CONCEPT").
metformin <- cs(descendants(1503297L), name = "Metformin")
# At least 2 metformin fills in the 365 days before index
atLeast(2, drugExposure(metformin), duringInterval(eventStarts(-365, 0)))
#> An object of class "Criteria"
#> Slot "occurrence":
#> An object of class "Occurrence"
#> Slot "type":
#> [1] "atLeast"
#>
#> Slot "count":
#> [1] 2
#>
#> Slot "isDistinct":
#> [1] NA
#>
#> Slot "countColumn":
#> [1] NA
#>
#>
#> Slot "query":
#> <Capr DrugExposure Query> Metformin
#>
#> Slot "aperture":
#> An object of class "EventAperture"
#> Slot "startWindow":
#> An object of class "EventWindow"
#> Slot "event":
#> [1] "start"
#>
#> Slot "start":
#> An object of class "Endpoint"
#> Slot "days":
#> [1] 365
#>
#> Slot "coeff":
#> [1] -1
#>
#>
#> Slot "end":
#> An object of class "Endpoint"
#> Slot "days":
#> [1] 0
#>
#> Slot "coeff":
#> [1] -1
#>
#>
#> Slot "index":
#> [1] "startDate"
#>
#>
#> Slot "endWindow":
#> An object of class "EventWindow"
#> Slot "event":
#> [1] NA
#>
#> Slot "start":
#> An object of class "Endpoint"
#> Slot "days":
#> [1] NA
#>
#> Slot "coeff":
#> [1] NA
#>
#>
#> Slot "end":
#> An object of class "Endpoint"
#> Slot "days":
#> [1] NA
#>
#> Slot "coeff":
#> [1] NA
#>
#>
#> Slot "index":
#> [1] NA
#>
#>
#> Slot "restrictVisit":
#> [1] FALSE
#>
#> Slot "ignoreObservationPeriod":
#> [1] FALSE
#>
#>