--- title: "RHRT: Example Pipelines" author: "Valeria Blesius" date: "`r Sys.Date()`" output: rmarkdown::html_vignette: keep_md: true vignette: > %\VignetteIndexEntry{RHRT: Example Pipelines} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- -------- ## Determining the HRT class of a person The main focus of the package is to determine the HRT parameters or class of a person by a long-term ECG measurement. Load the data as a numeric vector and use `vectorToHRT` to find HRTs, then `plot` and `getResults` to check the HRT: ```{r, fig.width=7, fig.height=4} library("RHRT") hrtl <- vectorToHRT(testdataLong) # create the HRTList plot(hrtl, main = "Zoomed in Tachogram") # plot the HRTs and check the variability getResults(hrtl) # get the averaged HRT parameters ``` The results do not pass the reliability check so we get "NR" instead of an HRT class. The plot shows that firstly TO is near to zero and secondly there is a high variability in the VPCSs. We can go deeper into the data by checking the exact parameters (including TT as an additional hint to the person's status) and zooming out of the plot: ```{r, fig.width=7, fig.height=4} round( getResults(hrtl, "full", TT = TRUE), digits = 2) # get the parameters and p-values of the variability check plot(hrtl, cropped = FALSE, main = "Full Tachogram") # plot the full VPCSs ``` As expected TO is not reliable with a p-value over 0.05. The VPCSs still seem to fluctuate a lot. We can can get a picture of the individual TO values by using `getHRTParams`: ```{r} tos <- getHRTParams(hrtl, "TO") tos summary(tos) par(mar=c(0, 3, 0, 0)) boxplot(tos) ``` These results can help to come to a well-founded decision on whether to classify the patient as HRT0/HRTA and trust the TO value or rather classify them conservatively as HRT1/HRTB. ## Comparing HRT results with different methodological parameters This is an example how the package can be used to analyse the HRT methodology. For instance, we can compare the difference in `TO` and `TS` values when the order of the calculation steps are switched. ```{r} library("RHRT") hrtl <- vectorToHRT(testdataLong) getResults(hrtl, type = "parameter", safe = FALSE) hrtl@avHRT <- calcAvHRT(hrtl, orTO = "avBefore", orTS = "avAfter") getResults(hrtl, type = "parameter", safe = FALSE) ``` -------- Further information can be found in the other vignettes: [synopsis](synopsis.md), [objects & functions](objects_functions.md) and [scientific background](background.md).