exclude_rows: Exclude rows of NONMEM dataset

View source: R/derived-data-prep.R

exclude_rowsR Documentation

Exclude rows of NONMEM dataset



A mechanism for excluding outliers during data cleaning. Create exploratory plots, identify rows of the dataset to be considered outliers for exclusion, and then feed that filtered dataset into this function to exclude them from the dataset. Requires a corresponding IGNORE statement - see argument descriptions for more details.


exclude_rows(d, dexcl, exclude_col = "EXCL")



A data.frame for containing the full NONMEM dataset. Should contain a column for identifying excluded rows named with the exclude_col argument.


A smaller data.frame consisting of rows to be ignored. Need not contain all columns of d but each column should be present in d.


Character (default = "EXCL"). Name of a binary exclude column in d. This should be accompanied with a IGNORE=(EXCL.GT.0) statement in $DATA.


A modified version of d with exclude_col set to 1 for rows coinciding with dexcl.

See Also

read_derived_data(), write_derived_data()


# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1", 
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))
d <- input_data(m1)
d$EXCL <- 0  ## start with no rows excluded

## use with dplyr
dexcl <- d %>%
  dplyr::filter(ID == 6, TIME > 3) %>%
  dplyr::select(ID, TIME, DV, EXCL)
dexcl ## view rows to be excluded
d <- d %>% exclude_rows(dexcl)

d %>% dplyr::filter(ID %in% 6)

NMproject documentation built on Sept. 30, 2022, 1:06 a.m.