Could you add to VID specification of step_02_03_T2.2_create_pregnancies_from_itemsets.R an as.numeric function in the *mo_source_value7** statement at line 33?
With this fix, the algorithm runs fine for VID database, even when in mo_source_value are also text for some rows, so mo_source_value is a character column.
Current code
if (thisdatasource=="VID"){
# start creating pregnancy_ongoing_date
dataset_item_sets<-dataset_item_sets[,`:=`(pregnancy_ongoing_date=date, meaning_ongoing_date=paste0("from_itemset_",item_set))]
# then pregnancy_start_date
dataset_item_sets<-dataset_item_sets[item_set=="GestationalAge" & mo_unit=="weeks", `:=`(pregnancy_start_date=pregnancy_ongoing_date-(mo_source_value*7), meaning_start_date=paste0("from_itemset_",item_set)) ]
Suggested Code
if (thisdatasource=="VID"){
# start creating pregnancy_ongoing_date
dataset_item_sets<-dataset_item_sets[,`:=`(pregnancy_ongoing_date=date, meaning_ongoing_date=paste0("from_itemset_",item_set))]
# then pregnancy_start_date
dataset_item_sets<-dataset_item_sets[item_set=="GestationalAge" & mo_unit=="weeks", `:=`(pregnancy_start_date=pregnancy_ongoing_date-(as.numeric(mo_source_value)*7), meaning_start_date=paste0("from_itemset_",item_set)) ]
Dear @GiorgioLimoncella,
Could you add to VID specification of step_02_03_T2.2_create_pregnancies_from_itemsets.R an as.numeric function in the *mo_source_value7** statement at line 33? With this fix, the algorithm runs fine for VID database, even when in mo_source_value are also text for some rows, so mo_source_value is a character column.
Current code
Suggested Code
thanks, Francisco.