filter_data: Filter Varioscan data

View source: R/filter_data.R

filter_dataR Documentation

Filter Varioscan data

Description

General-purpose function to filter Varioscan data in long format on different column values. Assumes these columns exist: [1] "dilution" "time" "series" "replicate" "OD" [6] "duration" "start_date" "strain" "extract" "date_extracted" [11] "medium"

Usage

filter_data(
  data,
  extracts = "all",
  strains = "all",
  replicates = "all",
  experiment_dates = "all",
  exclude_wells = "none"
)

Arguments

data

the dataframe holding all data

extracts

which extracts to include. Defaults to all extracts.

strains

the bacterial strains to include. Defaults to all strains.

replicates

the replicates to include. Defaults to all replicates.

experiment_dates

the start date values to include

exclude_wells

a list indicating which series/dilution/replicate should be excluded. Defaults to "none". See details.

Details

exclude The exclude parameter can be used to specifically exclude a single failed well (i.e. a single growth curve). If multiple should be excluded, a list should be provided with an element for each well.

It should be provided as a list in this form:

exclude_single <- list(
    start_date = "2-12-2021",
    series = "Exp1",
    dilution = 0.02,
    replicate = "1" #will remove both 1 and 1C
)

A special case is the removal of a control well (usually when infection has started to grow in it). When a control well is removed, all its values are replaced by its 2 hour value. Corrected values for the replicates will be recalculated.

exclude_control <- list(
    start_date = "2-12-2021",
    series = "Exp1",
    dilution = 0.02,
    replicate = "C" #need to recalculate the corrected values for all three replicates
)

Optionally, a list-of lists can be provided with repeated definitions of items to exclude:

exclude_multiple <- list(
    list(
        start_date = "2-12-2021",
        series = "Exp1",
        dilution = 0.02,
        replicate = "1" #will remove both 1 and 1C
    ),
    list(
        start_date = "2-12-2021",
        series = "Exp2",
        dilution = 0.01,
        replicate = "2" #will remove both 2 and 2C
    )
)

Value

filtered data with same columns

Examples

#filter replicates
filter_data(all_data, replicates = c("1C", "2C"))

# filter replicates and extract
filter_data(all_data, replicates = c("1C", "2C"), extracts = "Tulip stem")

filter replicates and lower date
filter_data(all_data, replicates = c("1C", "2C"))


MichielNoback/growthis documentation built on Jan. 4, 2023, 10:30 a.m.