Fix PID matching when joining data from participants

pull/134/head
JulioV 2021-05-11 16:42:58 -04:00
parent 32818a4802
commit e9cd9c94d7
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,7 @@
# Change Log # Change Log
## v1.2.1 (in progress)
- Fix PID matching when joining data from multiple participants. We can handle PIDS with an arbitrary format.
- Fix bug that did not correctly parse participants with more than 2 phones or more than 1 wearable
## v1.2.0 ## v1.2.0
- Sleep summary and intraday features are more consistent. - Sleep summary and intraday features are more consistent.
- Add wake and bedtime features for sleep summary data. - Add wake and bedtime features for sleep summary data.

View File

@ -10,7 +10,7 @@ feature_files <- snakemake@input[["feature_files"]]
features_of_all_participants <- tibble(filename = feature_files) %>% # create a data frame features_of_all_participants <- tibble(filename = feature_files) %>% # create a data frame
mutate(file_contents = map(filename, ~ read.csv(., stringsAsFactors = F, colClasses = c(local_segment = "character", local_segment_label = "character", local_segment_start_datetime="character", local_segment_end_datetime="character"))), mutate(file_contents = map(filename, ~ read.csv(., stringsAsFactors = F, colClasses = c(local_segment = "character", local_segment_label = "character", local_segment_start_datetime="character", local_segment_end_datetime="character"))),
pid = str_match(filename, ".*/([a-zA-Z]+?[0-9]+?)/.*")[,2]) %>% pid = str_match(filename, ".*/(.*)/all_sensor_features.csv")[,2]) %>%
unnest(cols = c(file_contents)) %>% unnest(cols = c(file_contents)) %>%
select(-filename) select(-filename)