The title must follow the year. This function detects different forms of
years (e.g. 2021
, 2021.
, (2021)
) and handles deduplicated years
(e.g. 2021a
, 2021b
, etc.).
The title must end with a dot. If the title contains internal dots, only the part of the title left to the first dot will be returned.
title_from_citation(x)
a character
of length 1. A citation written as
"Authors Year Title. Journal..."
A character
of length 1 with the extracted title. If the title
cannot be detected, an empty string is returned.
ref <- paste0("Quainoo, A.K., Wetten, A.C., Allainguillaume, J., 2008. The ",
"effectiveness of somatic embryogenesis in eliminating the ",
"cocoa swollen shoot virus from infected co- coa trees. ",
"J. Virol. Methods 149, 91e96.")
ref
#> [1] "Quainoo, A.K., Wetten, A.C., Allainguillaume, J., 2008. The effectiveness of somatic embryogenesis in eliminating the cocoa swollen shoot virus from infected co- coa trees. J. Virol. Methods 149, 91e96."
title_from_citation(ref)
#> [1] " The effectiveness of somatic embryogenesis in eliminating the cocoa swollen shoot virus from infected co- coa trees"