Reads a delimited text file and standardizes its columns for modeling.
Common positive-response names (positive, pos, and positive_response)
and negative-response names (negative, neg, and negative_response) are
detected automatically.
Arguments
- path
Path to a delimited text file.
- delim
Delimiter passed to
readr::read_delim().NULLasks readr to detect it.- dose, positive, negative
Optional source column names as strings, such as
positive = "infected". Omit to detect recognized aliases automatically.
Value
A tibble with columns dose, positive, negative, total, and
response, followed by any supplied metadata columns.
Examples
path <- system.file("extdata", "dose-response-example.csv", package = "singlehit")
trial <- read_dose_response(path)
trial
#> # A tibble: 3 × 9
#> dose positive negative total response study_id host dose_unit endpoint
#> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <chr> <chr>
#> 1 1 1 9 10 0.1 example_trial human FFU infection
#> 2 10 5 5 10 0.5 example_trial human FFU infection
#> 3 100 9 1 10 0.9 example_trial human FFU infection
# Identity columns survive import; response is a numeric proportion.