Code Monkey home page Code Monkey logo

parsehrv's Introduction

parseHRV

R scripts for parsing and plotting the change in heart rate variability (HRV) statistics over multiple days.

They were tested with exported data from EliteHRV and Heart Rate Monitor (BM innovations GmbH).

Heart Rate Monitor is a simple application that can record heart rate and RR. It is a great choice if you do not want to expose your heart rate data to third parties. It works without Google Play Services and it does not require you to create an account.

RHRV is utilized to calculate time-domain and frequency-domain statistics on the filtered RR data.

The generated heatmap calendar is based on Ryan Plant's implementation: https://ryanplant.netlify.app/post/calendar-heatmaps-in-ggplot/

Installation

Ubuntu requires the installation of r-cran-rgl package. (sudo apt-get install r-cran-rgl)

Move R scripts (HRV_parse.R, HRV_cal.R) to the folder containing the exported txt or csv files. (e.g. export/[email protected]/)

R scripts will install the required R libraries ("RHRV", "lubridate", "tidyverse", "zoo", "viridis") on the first run. It might take a few minutes.

If Rscript complains about /R/site-library not being writable, run R from command line and in R run: install.packages("RHRV", dependencies = TRUE)

Running the scripts

cd to the folder containing the exported txt or csv files and the R scripts (HRV_parse.R, HRV_cal.R).

Run the following command to parse the exported HRV files to csv file:

Rscript HRV_parse.R

Or if you exported data from Heart Rate Monitor:

Rscript HRV_parse.R HRmonitor

The output (HRV_parsed.csv) will contain the HRV statistics (e.g. eHRV, HR, SDNN, pNN50, SDSD, rMSSD, IRRR, MADRR, TINN, HRVi, LF, HF, LFHF) for each date. If multiple measurements were done on a given date, only the first one - the "Morning HRV reading" - is used.

Run the following command to create the heatmap calendar of rMSSD:

Rscript HRV_cal.R HRV_parsed.csv rMSSD 10 80

HRV_cal.R takes 4 arguements:

  1. file name (e.g. HRV_parsed.csv)
  2. name of one variable (e.g. eHRV, HR, SDNN, pNN50, SDSD, rMSSD, IRRR, MADRR, TINN, HRVi, LF, HF, LFHF)
  3. min of range
  4. max of range

Heatmap calendar

alt text

parsehrv's People

Contributors

bale-go avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.