paulhibbing / AGread

Read Accelerometer Files from ActiGraph Accelerometers
Other
15 stars 4 forks source link

Warning unnecessary? #27

Closed muschellij2 closed 3 years ago

muschellij2 commented 3 years ago

Does this warning make sense saying that contains both ACTIVITY and ACTIVITY2 packets?

## Personal dropbox sharing links to (1) GT3X file, (2) ActiLife raw data output CSV
gt3x.fpath <- "https://ndownloader.figshare.com/files/24642335"
csv.fpath <- "https://ndownloader.figshare.com/files/24642332"

file_directory <- tempdir()
gt3x_file <- file.path(file_directory, "TAS.gt3x.gz")
csv_file <- file.path(file_directory, "TAS.csv.gz")

## Download files to wd
if (!file.exists(gt3x_file)) download.file(gt3x.fpath, gt3x_file)
if (!file.exists(csv_file)) download.file(csv.fpath, csv_file)

out = AGread::read_gt3x(gt3x_file, parser = "dev")
#> Warning in dev_bin_type1(...): File contains both ACTIVITY and ACTIVITY2 packets:
#>   Returning ACTIVITY2 as `packets$RAW` and
#>   ACTIVITY as `packets$ACTIVITY`
head(out$RAW)
#>             Timestamp Accelerometer_X Accelerometer_Y Accelerometer_Z
#> 1 2019-09-17 18:40:00      0.00000000      0.00781250       0.9960938
#> 2 2019-09-17 18:40:00      0.01562500      0.00000000       1.0078125
#> 3 2019-09-17 18:40:00      0.01953125     -0.00781250       1.0039062
#> 4 2019-09-17 18:40:00      0.01562500     -0.01171875       1.0117188
#> 5 2019-09-17 18:40:00      0.01562500     -0.00781250       1.0078125
#> 6 2019-09-17 18:40:00      0.00781250     -0.00781250       1.0078125
out$ACTIVITY
#> NULL

Created on 2020-09-10 by the reprex package (v0.3.0)

Session info devtools::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.2 (2020-06-22) #> os macOS Catalina 10.15.6 #> system x86_64, darwin17.0 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2020-09-10 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> AGread 1.1.1 2020-08-31 [2] Github (paulhibbing/AGread@a0a7120) #> anytime 0.3.8 2020-07-24 [2] CRAN (R 4.0.2) #> assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.0.0) #> backports 1.1.9 2020-08-24 [2] CRAN (R 4.0.0) #> binaryLogic 0.3.9 2017-12-13 [2] CRAN (R 4.0.0) #> callr 3.4.3 2020-03-28 [2] CRAN (R 4.0.0) #> cli 2.0.2 2020-02-28 [2] CRAN (R 4.0.0) #> colorspace 1.4-1 2019-03-18 [2] CRAN (R 4.0.0) #> crayon 1.3.4 2017-09-16 [2] CRAN (R 4.0.0) #> data.table 1.13.0 2020-07-24 [2] CRAN (R 4.0.2) #> desc 1.2.0 2020-06-01 [2] Github (muschellij2/desc@b0c374f) #> devtools 2.3.1.9000 2020-08-25 [2] Github (r-lib/devtools@df619ce) #> digest 0.6.25 2020-02-23 [2] CRAN (R 4.0.0) #> dplyr 1.0.2 2020-08-18 [2] CRAN (R 4.0.2) #> ellipsis 0.3.1 2020-05-15 [2] CRAN (R 4.0.0) #> evaluate 0.14 2019-05-28 [2] CRAN (R 4.0.0) #> fansi 0.4.1 2020-01-08 [2] CRAN (R 4.0.0) #> fs 1.5.0 2020-07-31 [2] CRAN (R 4.0.2) #> generics 0.0.2 2018-11-29 [2] CRAN (R 4.0.0) #> ggplot2 3.3.2 2020-06-19 [2] CRAN (R 4.0.0) #> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2) #> gtable 0.3.0 2019-03-25 [2] CRAN (R 4.0.0) #> highr 0.8 2019-03-20 [2] CRAN (R 4.0.0) #> htmltools 0.5.0 2020-06-16 [2] CRAN (R 4.0.0) #> knitr 1.29 2020-06-23 [2] CRAN (R 4.0.2) #> lifecycle 0.2.0 2020-03-06 [2] CRAN (R 4.0.0) #> magrittr 1.5 2014-11-22 [2] CRAN (R 4.0.0) #> memoise 1.1.0 2017-04-21 [2] CRAN (R 4.0.0) #> munsell 0.5.0 2018-06-12 [2] CRAN (R 4.0.0) #> PAutilities 1.0.1 2020-08-06 [2] local #> pillar 1.4.6 2020-07-10 [2] CRAN (R 4.0.2) #> pkgbuild 1.1.0 2020-07-13 [2] CRAN (R 4.0.2) #> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.0.0) #> pkgload 1.1.0 2020-05-29 [2] CRAN (R 4.0.0) #> plyr 1.8.6 2020-03-03 [2] CRAN (R 4.0.0) #> prettyunits 1.1.1 2020-01-24 [2] CRAN (R 4.0.0) #> processx 3.4.3 2020-07-05 [2] CRAN (R 4.0.0) #> ps 1.3.4 2020-08-11 [2] CRAN (R 4.0.2) #> purrr 0.3.4 2020-04-17 [2] CRAN (R 4.0.0) #> R.methodsS3 1.8.0 2020-02-14 [2] CRAN (R 4.0.0) #> R.oo 1.23.0 2019-11-03 [2] CRAN (R 4.0.0) #> R.utils 2.9.2 2019-12-08 [2] CRAN (R 4.0.0) #> R6 2.4.1 2019-11-12 [2] CRAN (R 4.0.0) #> Rcpp 1.0.5 2020-07-06 [2] CRAN (R 4.0.0) #> remotes 2.2.0 2020-07-21 [2] CRAN (R 4.0.2) #> reshape2 1.4.4 2020-04-09 [2] CRAN (R 4.0.0) #> rlang 0.4.7.9000 2020-09-09 [1] Github (r-lib/rlang@60c0151) #> rmarkdown 2.3 2020-06-18 [2] CRAN (R 4.0.0) #> rprojroot 1.3-2 2018-01-03 [2] CRAN (R 4.0.0) #> scales 1.1.1 2020-05-11 [2] CRAN (R 4.0.0) #> sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 4.0.0) #> stringi 1.4.6 2020-02-17 [2] CRAN (R 4.0.0) #> stringr 1.4.0 2019-02-10 [2] CRAN (R 4.0.0) #> testthat 2.99.0.9000 2020-08-25 [2] Github (r-lib/testthat@6a24275) #> tibble 3.0.3 2020-07-10 [2] CRAN (R 4.0.2) #> tidyselect 1.1.0 2020-05-11 [2] CRAN (R 4.0.0) #> usethis 1.6.1.9001 2020-08-25 [2] Github (r-lib/usethis@860c1ea) #> vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.2) #> withr 2.2.0 2020-04-20 [2] CRAN (R 4.0.0) #> xfun 0.16 2020-07-24 [2] CRAN (R 4.0.2) #> yaml 2.2.1 2020-02-01 [2] CRAN (R 4.0.0) #> #> [1] /Users/johnmuschelli/Library/R/4.0/library #> [2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
paulhibbing commented 3 years ago

I originally put this warning in because I wasn't sure if ACTIVITY and ACTIVITY2 packets would ever occur in a single file. I had done my best to come up with a hypothetical solution, but I wanted to leave a flag for any real cases so I could follow up and be sure my solution worked. Looks like I got at least part of that wish...

We can discuss particulars more in your PR. A side note for this issue: I'm not sure how/why both packet types can exist in a single file. I'm going to check with the engineers, and I can report back anything I learn, if that's of interest.

paulhibbing commented 3 years ago

Oh wait. I didn't look closely enough at your output to see that both packet types do NOT occur in a single file, and instead packet elements are being mis-propagated and the wrong warning issued. I'll comment in the PR then.

paulhibbing commented 3 years ago

For what it's worth, I still don't believe at this point that it's possible for both ACTIVITY2 and ACTIVITY packets to reside in a single file. But I'm too paranoid to let that warning go, and it's not a difficult or time consuming thing to check for.

muschellij2 commented 3 years ago

I feel the exact same way. If both of them exist in the same file then you have to be very particular about the ordering of XYZ because one is XYZ ordered and the other one is YXZ ordered

On Fri, Sep 11, 2020 at 1:23 AM paulhibbing notifications@github.com wrote:

For what it's worth, I still don't believe at this point that it's possible for both ACTIVITY2 and ACTIVITY packets to reside in a single file. But I'm too paranoid to let that warning go, and it's not a difficult or time consuming thing to check for.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulhibbing/AGread/issues/27#issuecomment-690881573, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGPLSZSMIBZEZYG3HTWALSFGX5ZANCNFSM4RF3ZGKQ .

-- Best, John