-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecuteMeFirst.R
More file actions
58 lines (37 loc) · 1.86 KB
/
Copy pathexecuteMeFirst.R
File metadata and controls
58 lines (37 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
if (!require("pacman")) install.packages("pacman")
pacman::p_load("shiny",
"tidyverse",
"lubridate",
"purrr",
"parallel")
if(!require("accelerator")){
pacman::p_load("devtools")
install_github("fjbaron/accelerator")
}
library("accelerator")
#################################################3
#
#Folder where we find the meta and result folders generated by GGIR
baseEpoch="."
###############################################################################################################################
#### The configuration of the project is done in the next file
###############################################################################################################################
source("parameters.R")
formatoTiempo="%Y-%m-%d %H:%M:%S"
timezone="Europe/Madrid"
dfEpoch = getInfoOfFiles(str_c(baseEpoch,"/meta/basic"),prefix="^meta_",suffix="\\.bin") %>%
mutate (base=baseEpoch) %>%
select(base, RAW,path,size)
pb=progress_estimated(nrow(dfEpoch), min_time = 0)
dfEpoch=dfEpoch %>% mutate(meta=map(path, ~ infoGGIRmeta(.x,pb))) %>% unnest(cols = c(meta))
message("\n\nComputing everything for each accelerometry file generated by GGIR found in folder:")
message("\tbaseEpoch='",baseEpoch,"'\nbased on the definitions givens in file `parameters.R`\n")
cat("Please, rexecute this file every thime that you do any modification or add new accelerometry files.\n")
preProcessed=dfEpoch %>%
mutate( what = ggir2What(.) ) %>%
mutate( when = getWhen(.) ) %>%
mutate(summaryByWhen = getSummaryWhatByWhen(what,when) ) %>%
mutate(invalidWhen=getInvalidWhen(summaryByWhen)) %>%
mutate(validWhen=getValidWhen(when,invalidWhen))
save(preProcessed,dfEpoch,file="preProcessed.RData")
cat("Done. You can execute the shiny app called 'app.R'\n")