File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -46,20 +46,21 @@ get_block_item_map <- function(qsf) {
4646
4747
4848# ' Get wave number from qsf filename
49+ # '
50+ # ' Wave number as provided in the qsf name should be an integer or a float with
51+ # ' one decimal place.
4952# '
5053# ' @param path_to_qsf
5154# '
52- # ' @return integer wave number
55+ # ' @return (mostly) integer wave number
5356get_wave <- function (path_to_qsf ) {
54- qsf_name_pattern <- " (.*Wave_)([0-9]*)([.]qsf)$"
57+ qsf_name_pattern <- " (.*Wave_)([0-9]*([.][0-9])? )([.]qsf)$"
5558 if (! grepl(qsf_name_pattern , path_to_qsf )) {
5659 stop(" qsf filename should be of the format 'Survey_of_COVID-Like_Illness_-_Wave_XX.qsf'" )
5760 }
5861
59- wave <- as.integer(sub(
60- " (.*Wave_)([0-9]*)([.]qsf)$" ,
61- " \\ 2" ,
62- path_to_qsf )
62+ wave <- as.numeric(
63+ sub(qsf_name_pattern , " \\ 2" , path_to_qsf )
6364 )
6465
6566 return (wave )
You can’t perform that action at this time.
0 commit comments