filterr: Filter data with logging of results

View source: R/filterr.r

filterrR Documentation

Filter data with logging of results

Description

This function is a wrapper around dplyr::filter. Additional actions are performed on the background to log the information of the filter action, and info regarding the step is printed.

Usage

filterr(.data, ..., comment = "")

Arguments

.data

the data frame for which the filter should be created

...

arguments passed to dplyr::filter

comment

character with the reason of filtering used in log file

Details

The function can be used to keep track of records that are omitted in the data management process. In general one would like to keep all records from the source database (and use flags instead to exclude data) but in cases where this is not possible it is important to know what records are omitted and for which reason. Every time the function is used it creates a records in in a log file which can be used in the documentation.

Value

a filtered data frame

Author(s)

Richard Hooijmaijers

See Also

dplyr::filter

Examples


# For full trace-ability of source data, no pipes  
# are preferred 
dat1 <- filterr(Theoph,Subject==1)
dat2 <- Theoph |> filterr(Subject==2)
# Show what is being logged
get_log()$filterr_nfo

amp.dm documentation built on March 13, 2026, 5:08 p.m.