R/annual_recruitment.R
annual_recruitment.Rd
secuTrial exports inherently contain the information on which participant was registered at which point in time. This function makes use of this property to show annual recruitment.
annual_recruitment(x, rm_regex = "")
a secuTrialdata
object
character - specifies a regular expression to be removed from the centre names in the legend. e.g. rm_regex = "\\(.*\\)$" will remove trailing brackets and their contents.
a data.frame showing the annual recruitment counts per center
This function wraps plot_recruitment to retrieve the data.
# export location
expot_loc <- system.file("extdata", "sT_exports", "lnames",
"s_export_CSV-xls_CTU05_long_ref_miss_en_utf8.zip",
package = "secuTrialR")
# read export
sT_export <- read_secuTrial(expot_loc)
#> Read export successfully.
#> The following export options deviate from the suggested specifications:
#> Data from hidden fields is part of the export.
#> Short names was not selected.
# plot recruitment
annual_recruitment(sT_export)
#> Center Total 2018 2019
#> 1 All 11 1 10
#> 2 Charité Berlin (RPACK) 5 0 5
#> 3 Inselspital Bern (RPACK) 5 0 5
#> 4 Universitätsspital Basel (RPACK) 1 1 0
# show without trailing bracket
annual_recruitment(sT_export, rm_regex = "\\(.*\\)$")
#> Center Total 2018 2019
#> 1 All 11 1 10
#> 2 Charité Berlin 5 0 5
#> 3 Inselspital Bern 5 0 5
#> 4 Universitätsspital Basel 1 1 0