mhealthtools
mhealthtools: A Modular R Package for Extracting Features from Mobile and Wearable Sensor Data - Published in JOSS (2020)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in JOSS metadata -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Repository
A modular R package for extracting features from mobile sensor data
Basic Info
Statistics
- Stars: 14
- Watchers: 11
- Forks: 10
- Open Issues: 16
- Releases: 2
Metadata Files
README.md
mhealthtools
An R package for extracting features from mobile and wearable sensor data.
Description
mhealthtools processes raw data from various mobile and wearable sensors — such as accelerometer, gyroscope, touch screen, and camera — and outputs interpretable feature sets. Included with the package are feature extraction functions designed for activities used in mHealth applications developed by Sage Bionetworks, as well as general use functions that work with any activity using mobile and wearable sensors.
Installing
Install the mhealthtools package using devtools:
devtools::install_github("Sage-Bionetworks/mhealthtools")
Install the package with the vignettes:
devtools::install_github("Sage-Bionetworks/mhealthtools", build_vignettes = TRUE, dependencies = TRUE)
Alternatively, you can use this Docker image — based on rocker/tidyverse:latest — which comes with mhealthtools preinstalled.
Known Installation Issues
A common issue on Debian-based systems when installing the seewave dependency is to be missing the system dependencies libfftw3 and libsndfile1. In a shell, run:
$ apt install libfftw3-3 libfftw3-dev libsndfile1 libsndfile1-dev
to install these system dependencies, then retry the above devtools command.
If you are still having issues installing seewave, it may be necessary to also install the rgl library.
$ apt install r-cran-rgl
If not using a Debian-based system, please check for equivalent dependencies in your distro's package repository.
See the seewave installation page for more info.
Usage

There are two broad types of modules included with mhealthtools: activity-level and sensor-level modules.
Activity-level modules, like get_tremor_features and get_walk_features, extract features from every sensor involved in that activity. For example, the two previously mentioned functions both return accelerometer and gyroscope features. These functions are useful for their convenience — we can share parameters since the feature extraction process is nearly identical between accelerometer and gyroscope sensors.
get_tremor_features(accelerometer_data, gyroscope_data)
Underneath the hood of activity-level modules operate sensor-level modules. These modules are designed to extract features from a single sensor. If you were to design a new activity, you could borrow the already implemented sensor-level modules to extract its features.
gyroscope_features(gyroscope_data)
Both activity-level and sensor-level modules allow you to include additional steps in the feature extraction pipeline by passing additional arguments to their respective functions. If passing only the input data, a default set of features will be extracted from the raw sensor measurements. But suppose you are working with accelerometer data and would like to detrend, filter frequencies from, and window the axial measurements, then compute measurements for jerk, velocity and displacement — all before extracting features from each measurement.
accelerometer_features(
sensor_data = accelerometer_data,
detrend = TRUE,
frequency_filter = c(1, 25),
window_length = 256, # measured in number of samples
window_overlap = 0.2,
derived_kinematics = TRUE)
If you omit the funs and models arguments, a default set of features will be computed. But you can, of course, provide your own feature extraction functions.
``` my_features <- function(x) { data.frame( "mean" = mean(x), "median" = median(x), "sd" = sd(x)) }
gyroscopefeatures( sensordata = gyroscopedata, windowlength = 256, windowoverlap = 0.2, funs = myfeatures) ```
At the moment, only accelerometer and gyroscope sensors have this powerful processing pipeline implemented. For sensors such as screen and camera, it is more complicated to provide a useful set of preprocessing and feature extraction functions that generalize well to varied activities. We provide two activity-level functions for these sensors (get_heartrate and get_tapping_features), but no functionality at the sensor level of granularity — at least not yet.
For more information on how to augment mhealthtools with your own functionality — including not just your own feature extraction functions, but also your own preprocessing/data-cleaning steps — we highly recommend reading the vignettes.
Getting Help
If you have questions about using this package, there are a number of readily available resources. Vignettes are provided which demonstrate typical package use, how to extend the functionality of the provided functions, and feature definitions. Follow the installation instructions about installing the package with vignettes above and access the vignettes from within an R session:
browseVignettes("mhealthtools")
If you have questions about package usage that are not covered in the function docstrings or the vignettes, we encourage you to file an issue. If your question is not appropriate to be posted as a public issue, you may privately contact the package authors ([aut]) listed below.
Contributing and Reporting Issues
To report an issue, please file a GitHub issue with the main repo.
If you would like to contribute to mhealthtools, please file an issue so that we can establish a statement of need, avoid redundant work, and track progress on your contribution. Once an issue has been filed and we've identified how to best orient your contribution with package development as a whole, fork the main repo, branch off a feature branch from develop, commit and push your changes to your fork and submit a pull request for Sage-Bionetworks/mhealthtools:develop.
Authors
- Phil Snyder phil.snyder@sagebase.org [aut, cre]
- Meghasyam Tummalacherla meghasyam@sagebase.org [aut, ctb]
- Thanneer Perumal thanneer.perumal@sagebase.org [aut]
- Abhishek Pratap apratap@sagebase.org [ctb]
- Elias Chaibub Neto elias.chaibub.neto@sagebase.org [ctb]
License
Apache License Version 2.0, January 2004
Owner
- Name: Sage Bionetworks
- Login: Sage-Bionetworks
- Kind: organization
- Location: Seattle, Washington
- Website: www.sagebionetworks.org
- Repositories: 640
- Profile: https://github.com/Sage-Bionetworks
JOSS Publication
mhealthtools: A Modular R Package for Extracting Features from Mobile and Wearable Sensor Data
Authors
Tags
mhealth mobile health digital health ehealth accelerometer feature extraction gait heart rate tapping tremor parkinsonsGitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Phil Snyder | s****e@g****m | 208 |
| itismeghasyam | m****m@s****g | 157 |
| Thanneer Malai Perumal | t****l@s****g | 53 |
| Abhishek Pratap | a****t@g****m | 26 |
| itismeghasyam | r****o@i****l | 5 |
| Abhi | a****p@c****g | 5 |
| RStudio User | r****o@i****l | 4 |
| Kenneth Daily | k****y@s****g | 2 |
| Yooree Chae | y****e | 1 |
| Abhi Pratap | a****p@c****g | 1 |
| Abhi | a****p@X****l | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 44
- Total pull requests: 56
- Average time to close issues: about 1 month
- Average time to close pull requests: 4 days
- Total issue authors: 7
- Total pull request authors: 3
- Average comments per issue: 0.84
- Average comments per pull request: 0.27
- Merged pull requests: 50
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- philerooski (29)
- itismeghasyam (6)
- JulioV (3)
- Ebedthan (2)
- AKuederle (2)
- th1vairam (1)
- arytontediarjo (1)
Pull Request Authors
- philerooski (48)
- itismeghasyam (7)
- th1vairam (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- R >= 2.10 depends
- EMD * imports
- data.table * imports
- dplyr * imports
- e1071 * imports
- magrittr * imports
- pracma * imports
- purrr * imports
- rlang * imports
- seewave * imports
- signal * imports
- statcomp * imports
- stats * imports
- tibble * imports
- tidyr * imports
- ggplot2 * suggests
- knitr * suggests
- rmarkdown * suggests
- testthat * suggests
