# EVERYTHING HAS TO BE DONE IN R In the zip folder attached, you wil...

## Transcribed Text

EVERYTHING HAS TO BE DONE IN R In the zip folder attached, you will find multiple CVS files. In each folder, you will noticed two CVS files and they are labelled like 25 and 100, for example 4023_25 and 4023_100. I will prefer that you write a separate script for each 25 and 100 CSV file because their length of the data is different. Your script or code is used to calculate the RMSSD for each CSV file. Explanation on how to get the RMSSD is below. In those CVS, we have variables such as: Sec (time), %O2 SAT, Pulse, BPM, status, microseimens, etc. We will only focus on two variables and ignore the rest. We will only focus on "sec" and "Pulse". Sec is the time and Pulse is the pulse ox. WHAT WE NEED TO DO: First step: we want to find all the positive local maxima (peaks) in the Pulse variable. Exclude all the negative local maxima. We only need the local maxima that are positive (0 or greater than 0). Second step: In the variable called "sec", correspond the time for the positive local maxima found in the first step. (For example, if a local maxima was found at pulse equals 5, then correspond it with its time). Then create a new variable called RR. This new variable is calculated by having the difference between the time where we have the second positive local maxima and the time where we have the first positive local maxima. WE NEED TO EXCLUDE ALL THE MISSING VALUES OR NEGATIVES VALUES BETWEEN THE LOCAL MAXIMA. So, RR1 is sec2 - sec1. RR2 is sec3 - sec2. RR3 is sec4-sec3. And so on. Third step: From the RRs values we got, we will calculate what we call the "RMSSD". It stands for the Root Mean Square of Successive Differences. We get it by doing the below: RR Interval which (RR Intervol RR Intervol 21 (RR Interval 2 RR Interval 3) mean of above RMSSD This is: (RR1-RR2)^2 + (RR2-RR3)^2 + (RR3-RR3)^2 + then divide by how many intervals you have. Or how many differences () you have. We are pretty much finding the mean. Then, take the square root of the mean. That is the RMSSD we are looking for.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

library(dplyr)
library(ggplot2)

directory <- list.dirs(recursive = FALSE)
folders <- list.dirs(path = directory)

files <- c()

folders <- folders[-1]
for(f in folders){
a <- list.files(f)
a <- c(a, f)
files <- rbind(files, a)
}

files <- as.data.frame(files)
names(files) <- c("File1", "File2", "Path")

files <- files %>% mutate(file_name_100 = paste(Path, File1, sep="/"),
file_name_25 = paste(Path, File2, sep="/")) %>% select(file_name_25, file_name_100)

files_all <- c(files\$file_name_25, files\$file_name_100)

files_100 = c()
for(f in files_all){
if(length(grep("_100", x = f)) > 0){
files_100 <- c(files_100, f)
}
}...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

\$35.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Statistics-R Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.