diff --git a/docs/features/extracted.rst b/docs/features/extracted.rst index 84120a1d..0e7daad0 100644 --- a/docs/features/extracted.rst +++ b/docs/features/extracted.rst @@ -108,8 +108,8 @@ Name Units Description ========================= ========= ============= count SMS Number of SMS of type ``sms_type`` that occurred during a particular ``day_segment``. distinctcontacts contacts Number of distinct contacts that are associated with a particular ``sms_type`` during a particular ``day_segment``. -timefirstsms hours Number of hours between 12:00am (midnight) and the first ``SMS`` of a particular ``sms_type``. -timelastsms hours Number of hours between 12:00am (midnight) and the last ``SMS`` of a particular ``sms_type``. +timefirstsms minutes Number of minutes between 12:00am (midnight) and the first ``SMS`` of a particular ``sms_type``. +timelastsms minutes Number of minutes between 12:00am (midnight) and the last ``SMS`` of a particular ``sms_type``. countmostfrequentcontact SMS Number of ``SMS`` messages from the contact with the most messages of ``sms_type`` during a ``day_segment`` throughout the whole dataset of each participant. ========================= ========= ============= diff --git a/src/features/sms/sms_base.R b/src/features/sms/sms_base.R index fe6f4b4e..64335adb 100644 --- a/src/features/sms/sms_base.R +++ b/src/features/sms/sms_base.R @@ -44,8 +44,8 @@ base_sms_features <- function(sms, sms_type, day_segment, requested_features){ feature <- switch(feature_name, "count" = feature %>% summarise(!!paste("sms", sms_type, day_segment, feature_name, sep = "_") := n()), "distinctcontacts" = feature %>% summarise(!!paste("sms", sms_type, day_segment, feature_name, sep = "_") := n_distinct(trace)), - "timefirstsms" = feature %>% summarise(!!paste("sms", sms_type, day_segment, feature_name, sep = "_") := first(local_hour) + (first(local_minute)/60)), - "timelastsms" = feature %>% summarise(!!paste("sms", sms_type, day_segment, feature_name, sep = "_") := last(local_hour) + (last(local_minute)/60))) + "timefirstsms" = feature %>% summarise(!!paste("sms", sms_type, day_segment, feature_name, sep = "_") := first(local_hour) * 60 + first(local_minute)), + "timelastsms" = feature %>% summarise(!!paste("sms", sms_type, day_segment, feature_name, sep = "_") := last(local_hour) * 60 + last(local_minute))) features <- merge(features, feature, by="local_date", all = TRUE) }