Change SMS first and last metrics from hours to minutes
parent
f344c14e92
commit
c1e25ac1ad
|
@ -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.
|
||||
========================= ========= =============
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue