Issue loading heart rate data with RHRV Package in R MarkDown

39 views Asked by At

I'm having issues loading a .txt file in R Markdown using the LoadBeatAscii() function from the RHRV package. When I try to load from a folder it says:

Error in setwd(RecordPath) : cannot change working directory

Example

library(RHRV) 
hrv.data <- CreateHRVData() #This creates an empty list.object in which to load raw data into
hrv.data <- SetVerbose(hrv.data, TRUE) #to return additional information 
hrv.data <- LoadBeatAscii(hrv.data, RecordName = "beat_ascii.txt", RecordPath = "Data/beat_ascii.txt") #loading data from 'Data' folder into the hrv.data list object

The data that I am using in this example is available online from milegroup (it is the ascii file containing beats positions) called beat_ascii.txt available here: http://milegroup.github.io/ghrv/packages.html

Otherwise a small sample of the data is here:

c(1.036, 1.7, 2.364, 3.024, 3.668, 4.324, 4.98, 5.656, 6.312, 
6.96, 7.612, 8.248, 8.896, 9.54, 10.184, 10.824, 11.472, 12.128, 
12.776, 13.432, 14.088, 14.756, 15.424, 16.112, 16.768, 17.444, 
18.124, 18.816, 19.484, 20.164, 20.856, 21.552, 22.224, 22.9, 
23.6, 24.304, 24.968, 25.644, 26.328, 27.008, 27.68, 28.356, 
29.036, 29.696, 30.356, 31.032, 31.684, 32.344, 33, 33.66, 34.312, 
34.976, 35.644, 36.3, 36.964, 37.64, 38.308, 38.988, 39.676, 
40.348, 41.04, 41.744, 42.424, 43.1, 43.776, 44.46, 45.128, 45.808, 
46.496, 47.168, 47.808, 48.48, 49.136, 49.788, 50.44, 51.112, 
51.756, 52.412, 53.064, 53.712, 54.372, 55.028, 55.696, 56.344, 
57.008, 57.672, 58.332, 58.996, 59.652, 60.3, 60.948, 61.584, 
62.22, 62.852, 63.476, 64.096, 64.724, 65.356, 65.992, 66.628
)

Does anyone understand what the issue is?

UPDATE Someone else has had the same issue here but no solution.

1

There are 1 answers

0
kpm On

Mistake was naming the .txt file, which should be omitted from RecordPath:

hrv.data <- LoadBeatAscii(hrv.data, RecordName = "beat_ascii.txt", RecordPath = "C:/Users/Username/Desktop/Desktop/Data")