Description Usage Arguments Value Examples
The long dataset is obtained using gather_(dataset, "time", "number_alive", time_cols)
. test_id must by a variable identifying in an unique manner the replicate. The dataset must not contain NAs.
1 | find_previous_number_of_survivors(long_dataset, tprec, test_id_)
|
long_dataset |
A dataset in the long format, with one line for each measurement in time. |
tprec |
The time for which we want to compute the preceding time. |
test_id_ |
A unique identifier for each replicate. |
The previous time found in the dataset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | dataset = read_csv('data/RTT_dataV2_ImidaclopridCorrected.csv') %>%
mutate(test_id = seq(nrow(.)))
concentration_col = "Concentration"
species_col = "Identifier"
time_cols = c("0h", "24h", "48", "72", "R96h")
time_stamps = c(0,24,48,72,96)
ordered_time_cols = time_cols[order(time_stamps)]
make_time_col_name_time_stamp_converter = function(time_col_names, time_stamps){
cv = c(time_col_names, time_stamps) %>% setNames(c(time_stamps, time_col_names) %>% as.character())
cv_fun = function(ids){
sapply(ids, function(x) cv[x])
}
return(cv_fun)
}
time_col_name_time_stamp_converter = make_time_col_name_time_stamp_converter(time_col_names = time_cols, time_stamps = time_stamps)
long_dataset = gather_(dataset, "time", "number_alive", time_cols) %>%
mutate(time = time_col_name_time_stamp_converter(time) %>% as.numeric()) %>%
subset(!is.na(number_alive)) %>%
subset(time>0)
find_previous_number_of_survivors(long_dataset = long_dataset, test_id = 5, find_previous_measurement_time(long_dataset = long_dataset, test_id = 5, time = 96))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.