Skip to contents

This function search for date columns in every tables and returns the latest date for each patient with the variable it comes from.

Usage

lastnews_table(except = NULL, with_ties = FALSE)

Arguments

except

the datasets that should not be searched

with_ties

in case of tie, whether to return the first origin (FALSE) or all the origins that share this tie (TRUE).

Value

a dataframe

Examples

tm = edc_example_plot()
#> Warning: Option "edc_lookup" has been overwritten.
load_list(tm)
lastnews_table()
#> # A tibble: 50 × 3
#>    subjid origin     last_date          
#>    <chr>  <chr>      <dttm>             
#>  1 1      db3$date10 2010-08-01 18:59:37
#>  2 2      db3$date10 2010-07-31 15:32:45
#>  3 3      db3$date10 2010-07-22 11:24:37
#>  4 4      db3$date10 2010-07-23 20:38:32
#>  5 5      db3$date10 2010-07-15 07:09:47
#>  6 6      db3$date10 2010-07-20 12:27:00
#>  7 7      db3$date9  2010-07-28 16:24:09
#>  8 8      db3$date9  2010-07-19 15:24:18
#>  9 9      db3$date9  2010-08-11 03:48:27
#> 10 10     db3$date10 2010-07-30 20:41:23
#> # ℹ 40 more rows
lastnews_table(except="db3")
#> # A tibble: 50 × 3
#>    subjid origin    last_date          
#>    <chr>  <chr>     <dttm>             
#>  1 1      db2$date6 2010-06-12 10:53:27
#>  2 2      db2$date6 2010-06-20 02:27:29
#>  3 3      db2$date6 2010-06-12 21:21:28
#>  4 4      db2$date6 2010-06-19 20:25:02
#>  5 5      db2$date5 2010-06-15 11:26:57
#>  6 6      db2$date6 2010-06-11 22:06:25
#>  7 7      db2$date6 2010-06-17 07:46:07
#>  8 8      db2$date6 2010-06-22 10:18:23
#>  9 9      db2$date6 2010-05-31 00:51:54
#> 10 10     db2$date6 2010-06-12 03:57:46
#> # ℹ 40 more rows
lastnews_table(except="db3$date9")
#> # A tibble: 50 × 3
#>    subjid origin     last_date          
#>    <chr>  <chr>      <dttm>             
#>  1 1      db3$date10 2010-08-01 18:59:37
#>  2 2      db3$date10 2010-07-31 15:32:45
#>  3 3      db3$date10 2010-07-22 11:24:37
#>  4 4      db3$date10 2010-07-23 20:38:32
#>  5 5      db3$date10 2010-07-15 07:09:47
#>  6 6      db3$date10 2010-07-20 12:27:00
#>  7 7      db3$date10 2010-07-12 04:59:23
#>  8 8      db3$date10 2010-07-12 19:55:50
#>  9 9      db3$date8  2010-07-17 06:26:31
#> 10 10     db3$date10 2010-07-30 20:41:23
#> # ℹ 40 more rows