From a5cbbd852cbfa612434e19bc6fd6bff8c7fdf67e Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 00:36:21 -0400 Subject: [PATCH 01/32] corrected Auhtors@R format, removed duplicate field --- DESCRIPTION | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 29b0e9f..49f6dac 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,19 +1,15 @@ Package: psyphr Title: wrangling psychophysiological data Version: 0.1.0 -Authors@R: - c(person(given = "Kathleen E", - family = "Wendt", - role = c("aut", "cre"), - email = "wendtke@colostate.edu") - person(given = "Amanda") Description: an R package to wrangle psychophysiological data from MindWare Technologies. Authors@R: c(person("Kathleen E", "Wendt", email = "wendtke@colostate.edu", role = c("aut", "cre")), person("Amanda", "Gadrow", email = "amanda@rstudio.com", - role = "aut")), + role = "aut"), person("Audrey", "McCombs", email = "amccombs@iastate.edu", - role = "aut") + role = "aut"), + person() + ) License: MIT + file LICENSE Encoding: UTF-8 LazyData: true From 5288a66590d6aa0b6d79968f2ca4b3001a73e762 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 00:38:08 -0400 Subject: [PATCH 02/32] psyr -> psyphr --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 49f6dac..67e8a70 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,8 +13,8 @@ Authors@R: c(person("Kathleen E", "Wendt", email = "wendtke@colostate.edu", License: MIT + file LICENSE Encoding: UTF-8 LazyData: true -URL: https://github.com/wendtke/psyr -BugReports: https://github.com/wendtke/psyr/issues +URL: https://github.com/wendtke/psyphr +BugReports: https://github.com/wendtke/psyphr/issues Roxygen: list(markdown = TRUE) RoxygenNote: 6.1.1 Suggests: From aeec5cbdc78fb9953f62a77cd3fccc2443fe8c63 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 00:39:00 -0400 Subject: [PATCH 03/32] version number 0.1.0.9000 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 67e8a70..539b316 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: psyphr Title: wrangling psychophysiological data -Version: 0.1.0 +Version: 0.1.0.9000 Description: an R package to wrangle psychophysiological data from MindWare Technologies. Authors@R: c(person("Kathleen E", "Wendt", email = "wendtke@colostate.edu", role = c("aut", "cre")), From 616b42ce2c0007ad53078b23498b977203e1eeaa Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 00:39:47 -0400 Subject: [PATCH 04/32] add Siqi to Author --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 539b316..3d10927 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Authors@R: c(person("Kathleen E", "Wendt", email = "wendtke@colostate.edu", role = "aut"), person("Audrey", "McCombs", email = "amccombs@iastate.edu", role = "aut"), - person() + person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com") ) License: MIT + file LICENSE Encoding: UTF-8 From 892646303982066233a03688136d4d4ab8f8c463 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 00:51:11 -0400 Subject: [PATCH 05/32] delete example file from R/ --- R/example_file_grab.R | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 R/example_file_grab.R diff --git a/R/example_file_grab.R b/R/example_file_grab.R deleted file mode 100644 index f1748f5..0000000 --- a/R/example_file_grab.R +++ /dev/null @@ -1,17 +0,0 @@ -#Make a list of dataframes from workbook sheets - -path_name <- "tests/testthat/test_data/eda" -extension <- ".xlsx" - -list_of_sheets <- workbook_sheets(path_name, extension) - -#Subset the list of dataframes for a particular sheet name, eg "EDA_Stats" - -sheet_name <- "EDA_Stats" -subset_for_sheets(list_of_sheets = list_of_sheets, sheet_name = sheet_name) - -#Subset for list of dataframes for a particular file name, eg. "01-1-1" - -file_name <- "01-1-1" -subset_for_files(list_of_sheets = list_of_sheets, file_name = file_name) - From ff1b1504c724603b26f8e22c4c08bcd64f5b207c Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 02:50:53 -0400 Subject: [PATCH 06/32] typos, etc --- R/rename.R | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/R/rename.R b/R/rename.R index 49d30ad..fffc840 100644 --- a/R/rename.R +++ b/R/rename.R @@ -80,33 +80,29 @@ rename_hrv_editing_columns <- function(sheet) { rename_eda_stats_columns <- function(sheet){ - sheet <- sheet %>% - dpylr::rename(segment = segment, - start_time = `Start Time`, - end_time = `End Time`, - seg_length = `Segment Duration`, - total_scr = `Total SCRs`, - er_scr = `ER-SCRs`, - ns_scrs = `NS-SCRs`, - tonic_scl = `Tonic SCL`, - mean_sc = `Mean SC`, - tonic_period = `Tonic Period`) - - sheet - + sheet %>% + dplyr::rename(segment = `Segment Number`, + start_time = `Start Time`, + end_time = `End Time`, + seg_length = `Segment Duration`, + total_scr = `Total SCRs`, + er_scr = `ER-SCRs`, + ns_scrs = `NS-SCRs`, + tonic_scl = `Tonic SCL`, + mean_sc = `Mean SC`, + tonic_period = `Tonic Period`) } - rename_eda_editing_columns <- function(sheet){ - sheet <- sheet %>% - dplyr::rename(segment = segment, - eda_sec_cut = `EDA : Seconds Removed`, - eda_perc_cut = `EDA : Percentage Removed`, - eda_sec_est = `EDA : Seconds Estimated`, - eda_perc_est = `EDA : Percentage Estimated`, - resp_sec_cut = `Resp : Seconds Removed`, - resp_perc_cut = `Resp : Percentage Removed`, - resp_sec_est = `Resp : Seconds Estimated`, - resp_perc_est = `Resp : Percentage Estimated`) + sheet %>% + dplyr::rename(segment = `Segment Number`, + eda_sec_cut = `EDA : Seconds Removed`, + eda_perc_cut = `EDA : Percentage Removed`, + eda_sec_est = `EDA : Seconds Estimated`, + eda_perc_est = `EDA : Percentage Estimated`, + resp_sec_cut = `Resp : Seconds Removed`, + resp_perc_cut = `Resp : Percentage Removed`, + resp_sec_est = `Resp : Seconds Estimated`, + resp_perc_est = `Resp : Percentage Estimated`) } From 201dc19cd06ac105c2bba46fa4dafea2d02b03e1 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:21:23 -0400 Subject: [PATCH 07/32] typo, formatting, etc --- R/rename.R | 91 ++++++++++++++++++++++++------------------------------ 1 file changed, 40 insertions(+), 51 deletions(-) diff --git a/R/rename.R b/R/rename.R index fffc840..32efd07 100644 --- a/R/rename.R +++ b/R/rename.R @@ -19,63 +19,52 @@ #' rename_eda_stats_columns(sheet_data) #' rename_hrv_editing_columns(sheet_data) #' -#' -#' - - - rename_hrv_stats_columns <- function(sheet){ - sheet <- sheet %>% - dplyr::rename(segment = segment, - start_time = `Start Time`, - end_time = `End Time`, - seg_length = `Segment Duration`, - mean_hr = `Mean Heart Rate`, - rsa = RSA, - mean_ibi = `Mean IBI`, - r_peaks = `# of R's Found`, - resp_rate = `Respiration Rate`, - resp_amp = `Respiration Amplitude`, - resp_peak_freq = `Respiration Peak Frequency`, - resp_power = `Respiration Power`, - first_r_time = `First ECG R Time`, - last_r_time = `Last ECG R Time`, - r_r_duration = `First R to Last R Duration`, - sdnn = SDNN, - avnn = AVNN, - rmssd = RMSSD, - nn50 = NN50, - pnn50 = pNN50) - - sheet - + sheet %>% + dplyr::rename(segment = `Segment Numbe`, + start_time = `Start Time`, + end_time = `End Time`, + seg_length = `Segment Duration`, + mean_hr = `Mean Heart Rate`, + rsa = RSA, + mean_ibi = `Mean IBI`, + r_peaks = `# of R's Found`, + resp_rate = `Respiration Rate`, + resp_amp = `Respiration Amplitude`, + resp_peak_freq = `Respiration Peak Frequency`, + resp_power = `Respiration Power`, + first_r_time = `First ECG R Time`, + last_r_time = `Last ECG R Time`, + r_r_duration = `First R to Last R Duration`, + sdnn = SDNN, + avnn = AVNN, + rmssd = RMSSD, + nn50 = NN50, + pnn50 = pNN50) } rename_hrv_editing_columns <- function(sheet) { - sheet <- sheet %>% - dplyr::rename(segment = segment, - ecg_sec_cut = `ECG : Seconds Removed`, - ecg_perc_cut = `ECG : Percentage Removed`, - ecg_sec_est = `ECG : Seconds Estimated`, - ecg_perc_est = `ECG : Percentage Estimated`, - resp_sec_cut = `Resp : Seconds Removed`, - resp_perc_cut = `Resp : Percentage Removed`, - resp_sec_est = `Resp : Seconds Estimated`, - resp_perc_est = `Resp : Percentage Estimated`, - total_r_peaks = `Total Peaks`, - norm_r_peaks = `Normal Peaks`, - norm_r_perc = `% Normal Peaks`, - est_r_peaks = `Estimated Peaks`, - est_r_peaks_perc = `% Estimated Peaks`, - art_r_peaks = `Artifact Peaks`, - art_r_peaks_perc = `% Artifact Peaks`, - dur_est_r_r = `Duration of Estimated R-R Intervals`, - est_r_r_perc = `% of Estimated R-R Intervals`) - - sheet - + sheet %>% + dplyr::rename(segment = `Segment Number`, + ecg_sec_cut = `ECG : Seconds Removed`, + ecg_perc_cut = `ECG : Percentage Removed`, + ecg_sec_est = `ECG : Seconds Estimated`, + ecg_perc_est = `ECG : Percentage Estimated`, + resp_sec_cut = `Resp : Seconds Removed`, + resp_perc_cut = `Resp : Percentage Removed`, + resp_sec_est = `Resp : Seconds Estimated`, + resp_perc_est = `Resp : Percentage Estimated`, + total_r_peaks = `Total Peaks`, + norm_r_peaks = `Normal Peaks`, + norm_r_perc = `% Normal Peaks`, + est_r_peaks = `Estimated Peaks`, + est_r_peaks_perc = `% Estimated Peaks`, + art_r_peaks = `Artifact Peaks`, + art_r_peaks_perc = `% Artifact Peaks`, + dur_est_r_r = `Duration of Estimated R-R Intervals`, + est_r_r_perc = `% of Estimated R-R Intervals`) } From 8159fa1efcb15ba05df5ac26a5a4058537c8a98e Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:30:15 -0400 Subject: [PATCH 08/32] reading and parsing functions --- R/workbook_read_parse.R | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 R/workbook_read_parse.R diff --git a/R/workbook_read_parse.R b/R/workbook_read_parse.R new file mode 100644 index 0000000..8144c90 --- /dev/null +++ b/R/workbook_read_parse.R @@ -0,0 +1,88 @@ +#' Read a MindWare Workbook in Excel format +#' +#' @param path +#' @param device_vendor +#' +#' @return +#' @export +#' +#' @examples +read_workbook <- function(path, device_vendor = NULL){ + # Check if file type is Excel + `if`(is.na(readxl::excel_format(path)), stop("The input is not an Excel file")) + + sheet_names <- excel_sheets(path) + + # Read each sheet from workbook + suppressMessages({ + workbook <- map(sheet_names, + ~ read_excel(path = path, + sheet = ., + na = c("", "N/A"), + col_names = FALSE, + col_types = "text") + ) %>% set_names(sheet_names) + }) + + structure( + workbook, + class = c("psyphr_wb", class(workbook)), + device_vendor = device_vendor, + origin_path = path, + origin_mtime = file.mtime(path) + ) +} + + + +#' Parsing and tidying a Mindware EDA workbook +#' +#' @param workbook +#' +#' @return +#' @export +#' +#' @examples +tidy_EDA <- function(workbook){ + # EDA Stats + workbook[[1]] <- workbook[[1]] %>% transpose_convert_colnames() + + # SCR Stats + workbook[[2]] <- workbook[[2]] %>% + first_row_to_colnames() + + # Editing Stats + workbook[[3]] <- workbook[[3]] %>% transpose_convert_colnames() + + # Settings + workbook[[4]] <- workbook[[4]] %>% df_to_vector() + + return(workbook) +} + + +#' Turn a data frame into vector +#' +#' Use a data frame's first column to a vectors's names, the second column to its values. +#' +#' @param .data +#' +#' @return +#' +df_to_vector <- function(.data){ + res <- .data[[2]] + names(res) <- .data[[1]] + res +} + +transpose_convert_colnames <- function(.data) { + .data %>% + t() %>% + first_row_to_colnames() %>% + as_tibble() +} + +first_row_to_colnames <- function(.data){ + colnames(.data) <- .data[1,] + .data[-1,] +} From 98f2ae63ebd57cc1bae576ff000e5b0a7ada148d Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:30:56 -0400 Subject: [PATCH 09/32] deleted original functions --- NAMESPACE | 4 -- R/editing.R | 30 ------------ R/files.R | 47 ------------------- R/grab_files.R | 10 ---- R/grab_sheets.R | 10 ---- R/settings.R | 23 --------- R/stats.R | 29 ------------ .../test_data/eda/.~lock.01-1-1.xlsx# | 1 + 8 files changed, 1 insertion(+), 153 deletions(-) delete mode 100644 R/editing.R delete mode 100644 R/files.R delete mode 100644 R/grab_files.R delete mode 100644 R/grab_sheets.R delete mode 100644 R/settings.R delete mode 100644 R/stats.R create mode 100644 tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# diff --git a/NAMESPACE b/NAMESPACE index 62802ba..6ae9268 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,2 @@ # Generated by roxygen2: do not edit by hand -export(rename_hrv_editing_columns) -export(transform_editing_sheet) -export(transform_hrv_sheet) -export(transform_settings_sheet) diff --git a/R/editing.R b/R/editing.R deleted file mode 100644 index 0a6f378..0000000 --- a/R/editing.R +++ /dev/null @@ -1,30 +0,0 @@ - -#' Process "Editing Stats" sheet -#' -#' The transform_editing_sheet function transforms the raw Editing Stats sheet to use the Segment Names as -#' column names, make all values numeric, and add the name of the file as a column, so the data includes -#' the source designation. -#' -#' @param file_name -#' @param sheet -#' -#' @return a dataframe of segment data with a column containing the file name -#' @export -#' -#' @examples -#' transform_editing_sheet(name_of_file, sheet_data) -#' -transform_editing_sheet <- function(file_name, sheet){ - sheet <- sheet %>% - tidyr::gather(-`Segment Number`, - key = "segment", - value = "value") %>% - tidyr::spread(key = `Segment Number`, - value = value) %>% - dplyr::mutate_all(as.numeric) %>% - dplyr::mutate(file_name = file_name) - - sheet - -} - diff --git a/R/files.R b/R/files.R deleted file mode 100644 index 40107f7..0000000 --- a/R/files.R +++ /dev/null @@ -1,47 +0,0 @@ -library("readxl") - -workbook_sheets <- function(pathname, extension){ - - # Find files in directory - - files_full_path <- list.files(path = path_name, - pattern = extension, - full.names = TRUE) - file_names <- list.files(path = path_name, - pattern = extension, - full.names = FALSE) - file_names <- gsub(pattern = extension, - replacement = "", x = file_names) - - # Make names for dataframes - - df_names <- list() - for(i in 1:length(files_full_path)){ - sheet_names <- excel_sheets(files_full_path[i]) - df_names[[i]] <- paste(file_names[i], - sheet_names, sep = "_") - df_names[[i]] <- gsub(pattern = " ", - replacement = "_", - x = df_names[[i]]) - } - df_names <- unlist(df_names) - - # Read files - - list_of_wkbk_sheets <- list() - list_item <- 1 - for(i in 1:length(files_full_path)){ - sheet_names <- excel_sheets(files_full_path[i]) - - for(j in 1:length(sheet_names)){ - list_of_wkbk_sheets[[list_item]] <- as.data.frame(read_excel(files_full_path[i], - sheet = sheet_names[j])) - list_item <- list_item + 1 - } - } - - names(list_of_wkbk_sheets) <- df_names - - list_of_wkbk_sheets - -} diff --git a/R/grab_files.R b/R/grab_files.R deleted file mode 100644 index 982b34a..0000000 --- a/R/grab_files.R +++ /dev/null @@ -1,10 +0,0 @@ -#See example for how this works - -subset_for_files <- function(list_of_sheets, file_name){ - my_dfs <- grep(pattern = file_name, x = names(list_of_sheets)) - - for(i in my_dfs){ - assign(names(list_of_sheets)[i], list_of_sheets[[i]], envir=globalenv()) - } - -} diff --git a/R/grab_sheets.R b/R/grab_sheets.R deleted file mode 100644 index 8e730b9..0000000 --- a/R/grab_sheets.R +++ /dev/null @@ -1,10 +0,0 @@ -#See example for how this works - -subset_for_sheets <- function(list_of_sheets, sheet_name){ - my_dfs <- grep(pattern = sheet_name, x = names(list_of_sheets)) - - for(i in my_dfs){ - assign(names(list_of_sheets)[i], list_of_sheets[[i]], envir=globalenv()) - } - -} diff --git a/R/settings.R b/R/settings.R deleted file mode 100644 index 4552aba..0000000 --- a/R/settings.R +++ /dev/null @@ -1,23 +0,0 @@ -#' Process "Settings" sheet -#' -#' The transform_settings_sheet function transforms the raw Settings sheet to "flip it on its side" so -#' variables are columns and values are rows -#' -#' IMPORTANT NOTE: This needs to be tested -#' -#' @param file_name -#' @param sheet -#' -#' @return -#' @export -#' -#' @examples -#' -#' -transform_settings_sheet <- function(file_name, sheet){ - colnames(sheet) <- c("Setting", "Value") - sheet <- sheet %>% - tidyr::spread(key = "Setting", - value = "Value") %>% - dplyr::mutate(file_name = file_name) -} diff --git a/R/stats.R b/R/stats.R deleted file mode 100644 index 2f4a121..0000000 --- a/R/stats.R +++ /dev/null @@ -1,29 +0,0 @@ -#' Process "* Stats" sheet -#' -#' The transform_stats_sheet function transforms the raw HRV or EDA Stats sheet -#' (sheet #1) to use the Segment Names as column names, make all values numeric, -#' and add the name of the file as a column, so the data includes the -#' source designation. -#' -#' @param file_name -#' @param sheet -#' -#' @return a dataframe of segment data with a column containing file name -#' @export -#' -#' @examples -#' transform_stats_sheet(name_of_file, sheet_data) -#' -transform_stats_sheet <- function(file_name, sheet){ - sheet <- sheet %>% - tidyr::gather(-`Segment Number`, - key = "segment", - value = "value") %>% - tidyr::spread(key = `Segment Number`, - value = value) %>% - dplyr::mutate_all(as.numeric) %>% - dplyr::mutate(file_name = file_name) - - sheet - -} diff --git a/tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# b/tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# new file mode 100644 index 0000000..d1ae192 --- /dev/null +++ b/tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# @@ -0,0 +1 @@ +,DESKROG/siqi_,,02.05.2019 00:52,file:///C:/Users/siqi_/AppData/Roaming/LibreOffice/4; \ No newline at end of file From aa5829dcc1af50a9a19eb632a1f90735f4e02aa9 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:35:21 -0400 Subject: [PATCH 10/32] ro man --- NAMESPACE | 3 ++ man/df_to_vector.Rd | 14 +++++++++ man/read_workbook.Rd | 14 +++++++++ man/rename_hrv_editing_columns.Rd | 27 ---------------- man/rename_hrv_stats_columns.Rd | 31 +++++++++++++++++++ man/tidy_EDA.Rd | 14 +++++++++ man/transform_editing_sheet.Rd | 23 -------------- man/transform_hrv_sheet.Rd | 17 ---------- man/transform_settings_sheet.Rd | 18 ----------- .../test_data/eda/.~lock.01-1-1.xlsx# | 1 - 10 files changed, 76 insertions(+), 86 deletions(-) create mode 100644 man/df_to_vector.Rd create mode 100644 man/read_workbook.Rd delete mode 100644 man/rename_hrv_editing_columns.Rd create mode 100644 man/rename_hrv_stats_columns.Rd create mode 100644 man/tidy_EDA.Rd delete mode 100644 man/transform_editing_sheet.Rd delete mode 100644 man/transform_hrv_sheet.Rd delete mode 100644 man/transform_settings_sheet.Rd delete mode 100644 tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# diff --git a/NAMESPACE b/NAMESPACE index 6ae9268..2e801aa 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,2 +1,5 @@ # Generated by roxygen2: do not edit by hand +export(read_workbook) +export(rename_hrv_stats_columns) +export(tidy_EDA) diff --git a/man/df_to_vector.Rd b/man/df_to_vector.Rd new file mode 100644 index 0000000..c72e020 --- /dev/null +++ b/man/df_to_vector.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/workbook_read_parse.R +\name{df_to_vector} +\alias{df_to_vector} +\title{Turn a data frame into vector} +\usage{ +df_to_vector(.data) +} +\arguments{ +\item{.data}{} +} +\description{ +Use a data frame's first column to a vectors's names, the second column to its values. +} diff --git a/man/read_workbook.Rd b/man/read_workbook.Rd new file mode 100644 index 0000000..408802e --- /dev/null +++ b/man/read_workbook.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/workbook_read_parse.R +\name{read_workbook} +\alias{read_workbook} +\title{Read a MindWare Workbook in Excel format} +\usage{ +read_workbook(path, device_vendor = NULL) +} +\arguments{ +\item{device_vendor}{} +} +\description{ +Read a MindWare Workbook in Excel format +} diff --git a/man/rename_hrv_editing_columns.Rd b/man/rename_hrv_editing_columns.Rd deleted file mode 100644 index b61e66f..0000000 --- a/man/rename_hrv_editing_columns.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rename.R -\name{rename_hrv_editing_columns} -\alias{rename_hrv_editing_columns} -\title{Rename sheet columns after the sheet has been transformed.} -\usage{ -rename_hrv_editing_columns(sheet) -} -\arguments{ -\item{sheet}{} -} -\value{ -a dataframe with renamed columns -} -\description{ -Functions to change the column names to be easier to use by later analysis scripts. -They should only be called after transform_editing_sheet has already been used. -} -\details{ -TODO: add error handling in case this is run before transform_editing_sheet has been run, and the -column names are not as expected. I.e., detect whether the second calumn name is a number, and if so, -exit out gracefully with a message to run transform_*_sheet function first. -} -\examples{ -rename_hrv_editing_columns(sheet_data) - -} diff --git a/man/rename_hrv_stats_columns.Rd b/man/rename_hrv_stats_columns.Rd new file mode 100644 index 0000000..fb6ff7e --- /dev/null +++ b/man/rename_hrv_stats_columns.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rename.R +\name{rename_hrv_stats_columns} +\alias{rename_hrv_stats_columns} +\title{Rename sheet columns after the sheet has been transformed.} +\usage{ +rename_hrv_stats_columns(sheet) +} +\arguments{ +\item{sheet}{} +} +\value{ +a dataframe with renamed columns +} +\description{ +Functions to change the column names to be easier to use by later analysis scripts. +They should only be called after transform_* has already been used. +} +\details{ +TODO: add error handling in case this is run before transform_* has been run, +and the column names are not as expected. I.e., detect whether the second +column name is a number, and if so, +exit out gracefully with a message to run transform_* function first. +} +\examples{ +rename_hrv_stats_columns(sheet_data) +rename_hrv_editing_columns(sheet_data) +rename_eda_stats_columns(sheet_data) +rename_hrv_editing_columns(sheet_data) + +} diff --git a/man/tidy_EDA.Rd b/man/tidy_EDA.Rd new file mode 100644 index 0000000..b96b56a --- /dev/null +++ b/man/tidy_EDA.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/workbook_read_parse.R +\name{tidy_EDA} +\alias{tidy_EDA} +\title{Parsing and tidying a Mindware EDA workbook} +\usage{ +tidy_EDA(workbook) +} +\arguments{ +\item{workbook}{} +} +\description{ +Parsing and tidying a Mindware EDA workbook +} diff --git a/man/transform_editing_sheet.Rd b/man/transform_editing_sheet.Rd deleted file mode 100644 index 27e98bd..0000000 --- a/man/transform_editing_sheet.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/editing.R -\name{transform_editing_sheet} -\alias{transform_editing_sheet} -\title{Process "Editing Stats" sheet} -\usage{ -transform_editing_sheet(file_name, sheet) -} -\arguments{ -\item{sheet}{} -} -\value{ -a dataframe of segment data with a column containing the file name -} -\description{ -The transform_editing_sheet function transforms the raw Editing Stats sheet to use the Segment Names as -column names, make all values numeric, and add the name of the file as a column, so the data includes -the source designation. -} -\examples{ -transform_editing_sheet(name_of_file, sheet_data) - -} diff --git a/man/transform_hrv_sheet.Rd b/man/transform_hrv_sheet.Rd deleted file mode 100644 index fe14fa5..0000000 --- a/man/transform_hrv_sheet.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform_hrv_stats.R -\name{transform_hrv_sheet} -\alias{transform_hrv_sheet} -\title{Process "HRV Stats" sheet} -\usage{ -transform_hrv_sheet(file_name, sheet, rename_columns = TRUE) -} -\arguments{ -\item{rename_columns}{} -} -\description{ -The transform_hrv_sheet function ... -} -\examples{ - -} diff --git a/man/transform_settings_sheet.Rd b/man/transform_settings_sheet.Rd deleted file mode 100644 index 0ce9664..0000000 --- a/man/transform_settings_sheet.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/settings.R -\name{transform_settings_sheet} -\alias{transform_settings_sheet} -\title{Process "Settings" sheet} -\usage{ -transform_settings_sheet(file_name, sheet) -} -\arguments{ -\item{sheet}{} -} -\description{ -The transform_settings_sheet function transforms the raw Settings sheet to "flip it on its side" so -variables are columns and values are rows -} -\details{ -IMPORTANT NOTE: This needs to be tested -} diff --git a/tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# b/tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# deleted file mode 100644 index d1ae192..0000000 --- a/tests/testthat/test_data/eda/.~lock.01-1-1.xlsx# +++ /dev/null @@ -1 +0,0 @@ -,DESKROG/siqi_,,02.05.2019 00:52,file:///C:/Users/siqi_/AppData/Roaming/LibreOffice/4; \ No newline at end of file From be66fa2898aadeb2ee8ad0c7bd8513ffcb83f775 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:36:09 -0400 Subject: [PATCH 11/32] DESC: siqi role -> Author --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3d10927..92f7f89 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,8 @@ Authors@R: c(person("Kathleen E", "Wendt", email = "wendtke@colostate.edu", role = "aut"), person("Audrey", "McCombs", email = "amccombs@iastate.edu", role = "aut"), - person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com") + person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com", + role = "aut") ) License: MIT + file LICENSE Encoding: UTF-8 From 22b3d951ff995c488c0bdfa1ff80a2ca13aa9c81 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:37:22 -0400 Subject: [PATCH 12/32] depends magrittr --- DESCRIPTION | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index 92f7f89..7d0d28a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,3 +24,5 @@ Imports: dplyr, tidyr, readxl +Depends: + magrittr From 543fded359cae8e9b476a7819700ff9783c32546 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:37:41 -0400 Subject: [PATCH 13/32] imports purrr --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7d0d28a..2a50158 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,6 +23,7 @@ Suggests: Imports: dplyr, tidyr, - readxl + readxl, + purrr Depends: magrittr From 2d6aed620f8519e43929cf2bed2130400bc70d18 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:46:00 -0400 Subject: [PATCH 14/32] fixin stuff: explicit symbol qualification --- R/workbook_read_parse.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/R/workbook_read_parse.R b/R/workbook_read_parse.R index 8144c90..0d3f060 100644 --- a/R/workbook_read_parse.R +++ b/R/workbook_read_parse.R @@ -6,22 +6,24 @@ #' @return #' @export #' +#' #' @examples read_workbook <- function(path, device_vendor = NULL){ # Check if file type is Excel `if`(is.na(readxl::excel_format(path)), stop("The input is not an Excel file")) - sheet_names <- excel_sheets(path) + sheet_names <- readxl::excel_sheets(path) # Read each sheet from workbook suppressMessages({ - workbook <- map(sheet_names, - ~ read_excel(path = path, + workbook <- purrr::map(sheet_names, + ~ readxl::read_excel(path = path, sheet = ., na = c("", "N/A"), col_names = FALSE, col_types = "text") - ) %>% set_names(sheet_names) + ) %>% magrittr::set_names(sheet_names) + }) structure( @@ -79,7 +81,7 @@ transpose_convert_colnames <- function(.data) { .data %>% t() %>% first_row_to_colnames() %>% - as_tibble() + tibble::as_tibble() } first_row_to_colnames <- function(.data){ From 883714bb7183609ca4206eb78d74b48cf9fa4323 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:50:13 -0400 Subject: [PATCH 15/32] add bare_name() --- R/workbook_read_parse.R | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/R/workbook_read_parse.R b/R/workbook_read_parse.R index 0d3f060..7f14067 100644 --- a/R/workbook_read_parse.R +++ b/R/workbook_read_parse.R @@ -88,3 +88,16 @@ first_row_to_colnames <- function(.data){ colnames(.data) <- .data[1,] .data[-1,] } + + +#' Bare Name of a File, w.o. Path or Extension +#' +#' @param path +#' +#' @return string +#' @export +#' +#' @examples +bare_name <- function(path){ + gsub("(\\.+)(?!.*\\1).*$", "", basename(path), perl = TRUE) +} From e8ef9ed1792b4d008c3fbea6c39e9d86acd13d79 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:57:30 -0400 Subject: [PATCH 16/32] renaming stuff --- R/workbook_read_parse.R | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/R/workbook_read_parse.R b/R/workbook_read_parse.R index 7f14067..7638c69 100644 --- a/R/workbook_read_parse.R +++ b/R/workbook_read_parse.R @@ -1,3 +1,17 @@ +#' Read a MindWare EDA Workbook +#' +#' @param path +#' +#' @return +#' @export +#' +#' @examples +read_MW_EDA <- function(path) { + read_MW_workbook(path, device_vendor = "MindWare") %>% + tidy_MW_EDA() +} + + #' Read a MindWare Workbook in Excel format #' #' @param path @@ -8,7 +22,7 @@ #' #' #' @examples -read_workbook <- function(path, device_vendor = NULL){ +read_MW_workbook <- function(path, device_vendor = NULL){ # Check if file type is Excel `if`(is.na(readxl::excel_format(path)), stop("The input is not an Excel file")) @@ -45,7 +59,7 @@ read_workbook <- function(path, device_vendor = NULL){ #' @export #' #' @examples -tidy_EDA <- function(workbook){ +tidy_MW_EDA <- function(workbook){ # EDA Stats workbook[[1]] <- workbook[[1]] %>% transpose_convert_colnames() From 520ce647ee877cb273bdac996ab3f91c1b462d05 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 03:59:32 -0400 Subject: [PATCH 17/32] del: all tests --- tests/testthat/test-editing.R | 44 --------------------- tests/testthat/test-settings.R | 71 ---------------------------------- tests/testthat/test-stats.R | 55 -------------------------- 3 files changed, 170 deletions(-) delete mode 100644 tests/testthat/test-editing.R delete mode 100644 tests/testthat/test-settings.R delete mode 100644 tests/testthat/test-stats.R diff --git a/tests/testthat/test-editing.R b/tests/testthat/test-editing.R deleted file mode 100644 index b090756..0000000 --- a/tests/testthat/test-editing.R +++ /dev/null @@ -1,44 +0,0 @@ -context("Test the Editing Stats sheet processing") - -test_that("editing works for Editing Stats from HRV workbook", { - workbook_file_path <- "test_data/hrv/01_1_1.xlsx" - sheet <- readxl::read_xlsx(workbook_file_path, sheet = 8) - t_sheet <- transform_editing_sheet("01_1_1", sheet) - exp_names <- c("segment", - "% Artifact Peaks", - "% Estimated Peaks", - "% Normal Peaks", - "% of Estimated R-R Intervals", - "Artifact Peaks", - "Duration of Estimated R-R Intervals", - "ECG : Percentage Estimated", - "ECG : Percentage Removed", - "ECG : Seconds Estimated", - "ECG : Seconds Removed", - "Estimated Peaks", - "Normal Peaks", - "Resp : Percentage Estimated", - "Resp : Percentage Removed", - "Resp : Seconds Estimated", - "Resp : Seconds Removed", - "Total Peaks", - "file_name") - expect_equal(names(t_sheet), exp_names) -}) - -test_that("editing works for Editing Stats from EDA workbook", { - workbook_file_path <- "test_data/eda/01-1-1.xlsx" - sheet <- readxl::read_xlsx(workbook_file_path, sheet = 3) - t_sheet <- transform_editing_sheet("01-1-1", sheet) - exp_names <- c("segment", - "EDA : Percentage Estimated", - "EDA : Percentage Removed", - "EDA : Seconds Estimated", - "EDA : Seconds Removed", - "Resp : Percentage Estimated", - "Resp : Percentage Removed", - "Resp : Seconds Estimated", - "Resp : Seconds Removed", - "file_name") - expect_equal(names(t_sheet), exp_names) -}) diff --git a/tests/testthat/test-settings.R b/tests/testthat/test-settings.R deleted file mode 100644 index bb00e28..0000000 --- a/tests/testthat/test-settings.R +++ /dev/null @@ -1,71 +0,0 @@ -context("Test the Settings sheet processing") - -test_that("editing works for Settings from HRV workbook", { - workbook_file_path <- "test_data/hrv/01_1_1.xlsx" - sheet <- readxl::read_xlsx(workbook_file_path, sheet = 9, col_names = FALSE) - t_sheet <- transform_settings_sheet("01_1_1", sheet) - exp_names <- c("50/60 hz Notch Filter", - "Baseline/Muscle Noise Filter", - "BioLab Filter", - "Calculation Method", - "Date", - "ECG Inverted", - "Edit File Name", - "Edit File Used?", - "End Time", - "File Name", - "HF/RSA Frequency Band", - "IBI Min/Max Check", - "Interval Period", - "LF Frequency Band", - "MAD MED Check", - "Maximum Heart Rate (BPM)", - "Minimum Heart Rate (BPM)", - "Mode", - "Respiration Max", - "Respiration Min", - "Respiration Signal Used", - "Sampling Frequency", - "Segment Time", - "Show Events", - "Start Time", - "Time", - "Use HF/RSA Band for Resp Rate", - "Version", - "VLF Frequency Band", - "Windowing", - "file_name") - expect_equal(names(t_sheet), exp_names) -}) - -test_that("editing works for settings from EDA workbook", { - workbook_file_path <- "test_data/eda/01-1-1.xlsx" - sheet <- readxl::read_xlsx(workbook_file_path, sheet = 4, col_names = FALSE) - t_sheet <- transform_settings_sheet("01-1-1", sheet) - exp_names <- c("BioLab Filter", - "Block Size", - "Calculation Method", - "Date", - "Edit File Name", - "Edit File Used?", - "End Time", - "ER-SCR Latency Max", - "ER-SCR Latency Min", - "File Name", - "Interval Period", - "Mode", - "Override Gain Settings", - "Respiration Signal Used", - "Rolling Filter On/Off", - "Sampling Frequency", - "Segment Time", - "Show Events", - "Start Time", - "Time", - "uS Threshold", - "uS/Volt", - "Use All Events", - "Version", - "file_name") - expect_equal(names(t_sheet), exp_names) -}) diff --git a/tests/testthat/test-stats.R b/tests/testthat/test-stats.R deleted file mode 100644 index 65b12e7..0000000 --- a/tests/testthat/test-stats.R +++ /dev/null @@ -1,55 +0,0 @@ -context("Test the HRV or EDA Stats sheet processing") - -test_that("editing works for Stats from HRV workwork", { - workbook_file_path <- "test_data/hrv/01_1_1.xlsx" - sheet <- readxl::read_xlsx(workbook_file_path, sheet = 1) - t_sheet <- transform_stats_sheet("01_1_1", sheet) - exp_names <- c( "segment", - "# of R's Found", - "AVNN", - "End Event", - "End Time", - "First ECG R Time", - "First R to Last R Duration", - "Last ECG R Time", - "Manual Override", - "Mean Heart Rate", - "Mean IBI", - "NN50", - "pNN50", - "Respiration Amplitude", - "Respiration Peak Frequency", - "Respiration Power", - "Respiration Rate", - "RMSSD", - "RSA", - "SDNN", - "Segment Duration", - "Start Event", - "Start Time", - "Threshold (volts)", - "file_name") - expect_equal(names(t_sheet), exp_names) - -}) - - -test_that("editing works for Stats from EDA workbook", { - workbook_file_path <- "test_data/eda/01-1-1.xlsx" - sheet <- readxl::read_xlsx(workbook_file_path, sheet = 1) - t_sheet <- transform_stats_sheet("01-1-1", sheet) - exp_names <- c("segment", - "End Event", - "End Time", - "ER-SCRs", - "Mean SC", - "NS-SCRs", - "Segment Duration", - "Start Event", - "Start Time", - "Tonic Period", - "Tonic SCL", - "Total SCRs", - "file_name") - expect_equal(names(t_sheet), exp_names) -}) From a40e89b5311014cbc9c2699e5015995081c094c7 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Thu, 2 May 2019 10:27:48 -0400 Subject: [PATCH 18/32] ro man --- NAMESPACE | 6 ++++-- man/bare_name.Rd | 17 +++++++++++++++++ man/read_MW_EDA.Rd | 14 ++++++++++++++ man/{read_workbook.Rd => read_MW_workbook.Rd} | 6 +++--- man/{tidy_EDA.Rd => tidy_MW_EDA.Rd} | 6 +++--- 5 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 man/bare_name.Rd create mode 100644 man/read_MW_EDA.Rd rename man/{read_workbook.Rd => read_MW_workbook.Rd} (72%) rename man/{tidy_EDA.Rd => tidy_MW_EDA.Rd} (80%) diff --git a/NAMESPACE b/NAMESPACE index 2e801aa..2cc3cd8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,7 @@ # Generated by roxygen2: do not edit by hand -export(read_workbook) +export(bare_name) +export(read_MW_EDA) +export(read_MW_workbook) export(rename_hrv_stats_columns) -export(tidy_EDA) +export(tidy_MW_EDA) diff --git a/man/bare_name.Rd b/man/bare_name.Rd new file mode 100644 index 0000000..b4dbc3f --- /dev/null +++ b/man/bare_name.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/workbook_read_parse.R +\name{bare_name} +\alias{bare_name} +\title{Bare Name of a File, w.o. Path or Extension} +\usage{ +bare_name(path) +} +\arguments{ +\item{path}{} +} +\value{ +string +} +\description{ +Bare Name of a File, w.o. Path or Extension +} diff --git a/man/read_MW_EDA.Rd b/man/read_MW_EDA.Rd new file mode 100644 index 0000000..fd88fab --- /dev/null +++ b/man/read_MW_EDA.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/workbook_read_parse.R +\name{read_MW_EDA} +\alias{read_MW_EDA} +\title{Read a MindWare EDA Workbook} +\usage{ +read_MW_EDA(path) +} +\arguments{ +\item{path}{} +} +\description{ +Read a MindWare EDA Workbook +} diff --git a/man/read_workbook.Rd b/man/read_MW_workbook.Rd similarity index 72% rename from man/read_workbook.Rd rename to man/read_MW_workbook.Rd index 408802e..b8f62d4 100644 --- a/man/read_workbook.Rd +++ b/man/read_MW_workbook.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/workbook_read_parse.R -\name{read_workbook} -\alias{read_workbook} +\name{read_MW_workbook} +\alias{read_MW_workbook} \title{Read a MindWare Workbook in Excel format} \usage{ -read_workbook(path, device_vendor = NULL) +read_MW_workbook(path, device_vendor = NULL) } \arguments{ \item{device_vendor}{} diff --git a/man/tidy_EDA.Rd b/man/tidy_MW_EDA.Rd similarity index 80% rename from man/tidy_EDA.Rd rename to man/tidy_MW_EDA.Rd index b96b56a..69f4e7a 100644 --- a/man/tidy_EDA.Rd +++ b/man/tidy_MW_EDA.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/workbook_read_parse.R -\name{tidy_EDA} -\alias{tidy_EDA} +\name{tidy_MW_EDA} +\alias{tidy_MW_EDA} \title{Parsing and tidying a Mindware EDA workbook} \usage{ -tidy_EDA(workbook) +tidy_MW_EDA(workbook) } \arguments{ \item{workbook}{} From dd7b51bf13d87f8d37e7debee169630555a9ed40 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Mon, 6 May 2019 16:57:40 -0400 Subject: [PATCH 19/32] initiate README --- .Rbuildignore | 1 + README.Rmd | 59 +++++++++++++++++++++++++++++ README.md | 60 ++++++++++++++++++++++++++++++ man/figures/README-pressure-1.png | Bin 0 -> 3744 bytes 4 files changed, 120 insertions(+) create mode 100644 README.Rmd create mode 100644 README.md create mode 100644 man/figures/README-pressure-1.png diff --git a/.Rbuildignore b/.Rbuildignore index b5e1da3..76d1027 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,4 @@ ^psyr\.Rproj$ ^\.Rproj\.user$ ^LICENSE\.md$ +^README\.Rmd$ diff --git a/README.Rmd b/README.Rmd new file mode 100644 index 0000000..9dc94ca --- /dev/null +++ b/README.Rmd @@ -0,0 +1,59 @@ +--- +output: github_document +--- + + + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.path = "man/figures/README-", + out.width = "100%" +) +``` +# psyphr + + + + +The goal of psyphr is to ... + +## Installation + +You can install the released version of psyphr from [CRAN](https://CRAN.R-project.org) with: + +``` r +install.packages("psyphr") +``` + +And the development version from [GitHub](https://github.com/) with: + +``` r +# install.packages("devtools") +devtools::install_github("wendtke/psyphr") +``` +## Example + +This is a basic example which shows you how to solve a common problem: + +```{r example} +library(psyphr) +## basic example code +``` + +What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so: + +```{r cars} +summary(cars) +``` + +You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. + +You can also embed plots, for example: + +```{r pressure, echo = FALSE} +plot(pressure) +``` + +In that case, don't forget to commit and push the resulting figure files, so they display on GitHub! diff --git a/README.md b/README.md new file mode 100644 index 0000000..849a3b2 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ + + + +# psyphr + + + + + +The goal of psyphr is to … + +## Installation + +You can install the released version of psyphr from +[CRAN](https://CRAN.R-project.org) with: + +``` r +install.packages("psyphr") +``` + +And the development version from [GitHub](https://github.com/) with: + +``` r +# install.packages("devtools") +devtools::install_github("wendtke/psyphr") +``` + +## Example + +This is a basic example which shows you how to solve a common problem: + +``` r +library(psyphr) +#> Loading required package: magrittr +## basic example code +``` + +What is special about using `README.Rmd` instead of just `README.md`? +You can include R chunks like so: + +``` r +summary(cars) +#> speed dist +#> Min. : 4.0 Min. : 2.00 +#> 1st Qu.:12.0 1st Qu.: 26.00 +#> Median :15.0 Median : 36.00 +#> Mean :15.4 Mean : 42.98 +#> 3rd Qu.:19.0 3rd Qu.: 56.00 +#> Max. :25.0 Max. :120.00 +``` + +You’ll still need to render `README.Rmd` regularly, to keep `README.md` +up-to-date. + +You can also embed plots, for example: + + + +In that case, don’t forget to commit and push the resulting figure +files, so they display on GitHub\! diff --git a/man/figures/README-pressure-1.png b/man/figures/README-pressure-1.png new file mode 100644 index 0000000000000000000000000000000000000000..c092055f2d496ba61e9f3073c00bd2087bd1a77b GIT binary patch literal 3744 zcmds4cTiL57LOQdLJ$E#L6EY5NQqd0NC_$eYfz-C6cLHUm7<80gc714O@g|FA|@(} zC`fS;5DmQ-6G0FOgqnb1Nq|6rfaG1=owqx)Z|3dW_s5%gcg~&jednBe?sw1c{Jw8) zg8eCLN%39cAP`8>*5O_AS4X9@HFH%9}uyJo{3CzC)tm=#HaZ9JLhciPdH(6D0PI!MOnR~l;_c^~o z&cnD(?fPmYO=IBuZF7@y#|F70E{r$Y^0p;+jJh6J%uo;q>a^*{Bh9QRS}gB+Y2YCu zju-Xpk^DZaEcLg!)TKoo?;~TBgk7vf$sV~~>eMw9k&JO#0(o3` zYeQRucf9TU(a5<|_|vFFl}E0B6p1l}>VU@w*eQm+waFGpFF-4W9jG&E{`5)G(8cR% z6-i~`o=vH`P#M6l$R**Kp^&PPn`wt@3YND3&J}l!OeTRDAdljj#P)3sGiF*!tH|5p zPmu7<=S_3NRV-5o--8ov*M`TWa2-m*L;BrJ6>TE2UTAGIgG+LY2?fg4e|`aXgBraa5X-|TYxlAzyqtMZPcGOLQ~-#(Ui=T>ZV|@ zm9{cg+0)$oQ^ALDDtj0g1QA!Pq2QQSF;BUq8c$nkZOyr@3-*m|rrJA3xI1cK0Ubw@ zW(!U=PKKmSJmNhY@*^TXswW#0MSPzqW1&EooMBqVYq2~o(*x9;fiXa{2gY0y5QMk+ zrX-k_s(Rg~ew8z0^jl=1yL`@=#V1_FH8rX=gBHF;Pfj2kU2V0bpT@K^0vCia7{s}5jNv$ zVjEk*yGhIFRWpZtz!_CztFzvD^}r%fL=4k%8kOf2Ew6$EFmG{QBl4+jh6mkZ1kyLA z(j~APus+1O5YJ@IqVo38tOg`x7W3Xj2sLSR;*RdZ{x@>5x@2Eha-h!g=0HQGblI?% zMP3zhybT6yy-v1}A8>0Gp*u*p{7^}5;W1c>&Ac_ z!3HdTKVN1so**T3+jcO4-;fCR-u^|YtZlw>H{VnSd-0y1>)c}Y8p@g!`uzlVdnazp z`XoIXC4n8&N}|^VY-sSVo5tW1B=7iReh+a+6c0JxPROZ}X&r=m_RvsgTQ zv-zxMgIR1^#Wf+x<=SkCP=gcicUY@qrlv_}(uB-r+!-s8%|TCHU-*35RDC+xa4Jxm zPfoFz525D&^T^Y&VTf@yQ$Hf-PreAe>nrlLgctYVduacx#g2vxG zm61QxbQTX!cwD})Sxh90O z5y?8TRA!W7Km6c^ui`Y9$Zd*z`=`G6$>A`Q{3UMxI_6d25$|1^tp&X@N2u@m zTL#OC#9}npt;IjY@oNB>@;J*Ifd*RobZa|-T4qG>zG^`%Tvqhp-15)ZR_x+60iUJ~ zsJNu>AK0QO;lo($J~brz=-8o#e%@5D2i=++X6cXak@TTukKc4O5B6RAe52u3*z2O> zkcD}l1;WchA4Y)V*TE|3wYV$sVkOp$(xytI8R#Znp6=Cu+ z%2OeMyY@9&b+5qeIc8V-CSJ4c`n>GAc-*}>@t`&ri{5uet_#mHSv4qncKTded8v9%E|j(Cov1TcxH*L$7>L)l{9=}| zo8HJPx~#zU<*G}b3*EP}6&gwoH2T4-kR@<1=k^Pqi+mQTR1Lf{1nKM4n^SDmWtUn& zBNGIN&?{5b9+B79elF(x7`c0jiP_04k5;z@vkDM})lDI9!IrDm!9?CoE5evy<~@u% zZ?+DjR&aeYXkYy=N#_^qQ2FMA?31M8nR~}(DyHE{GF_8`$Rn}UIR*`be2&H)c%;W& z(&Wi(FCqUL58r+>bT&)tNIndj6xx=$%)AY6MmZ5Ly$-4)_sbj6n-%+EB4NjIm z7-qk>B=UUY7zdJ^hP-IJ`RC!lms4jem89;#8`P;Wq6bZdB)=VxfB$c5CUD(esJc1` Szq;|KX=`=rc+t@dvHt+rJImPs literal 0 HcmV?d00001 From 8c39fc6e4a6c9cd28b3ef68762ebea782990e981 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Mon, 6 May 2019 16:59:23 -0400 Subject: [PATCH 20/32] lifecycle: experimental --- README.Rmd | 1 + README.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.Rmd b/README.Rmd index 9dc94ca..4767019 100644 --- a/README.Rmd +++ b/README.Rmd @@ -15,6 +15,7 @@ knitr::opts_chunk$set( # psyphr +[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) The goal of psyphr is to ... diff --git a/README.md b/README.md index 849a3b2..c6a3cb7 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ +[![Lifecycle: +experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) The goal of psyphr is to … From 5cb351d2dfdcc1fff440d3e815703fdd1f2e8581 Mon Sep 17 00:00:00 2001 From: Siqi Zhang Date: Mon, 6 May 2019 17:12:39 -0400 Subject: [PATCH 21/32] tidbits for README --- README.Rmd | 39 ++++++++++++++------------------------- README.md | 54 +++++++++++++++++++----------------------------------- 2 files changed, 33 insertions(+), 60 deletions(-) diff --git a/README.Rmd b/README.Rmd index 4767019..a56ae59 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,7 +18,20 @@ knitr::opts_chunk$set( [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) -The goal of psyphr is to ... +The `psyphr` R package turns [psychophysilology](https://en.wikipedia.org/wiki/Psychophysiology) lab data from proprietary equipments into a [tidy](http://vita.had.co.nz/papers/tidy-data.pdf) form, wherever approapriate, for downstream analysis. + +The package is currently under active development. Currently, only [EDA](https://support.mindwaretech.com/manuals/software/eda/3-2/) and [HRV](https://support.mindwaretech.com/manuals/software/hrv/3-2/) data from MindWare is supported. + + +## TODO + +The development team considers the following for the package's future: + +- Customizable data QA utilities, with meaningful defaults +- Common visualization schemes +- Study compilation utility +- Compatibility on data feeds from more vendors' equipments + ## Installation @@ -34,27 +47,3 @@ And the development version from [GitHub](https://github.com/) with: # install.packages("devtools") devtools::install_github("wendtke/psyphr") ``` -## Example - -This is a basic example which shows you how to solve a common problem: - -```{r example} -library(psyphr) -## basic example code -``` - -What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so: - -```{r cars} -summary(cars) -``` - -You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. - -You can also embed plots, for example: - -```{r pressure, echo = FALSE} -plot(pressure) -``` - -In that case, don't forget to commit and push the resulting figure files, so they display on GitHub! diff --git a/README.md b/README.md index c6a3cb7..a407468 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,25 @@ experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) -The goal of psyphr is to … +The `psyphr` R package turns +[psychophysilology](https://en.wikipedia.org/wiki/Psychophysiology) lab +data from proprietary equipments into a +[tidy](http://vita.had.co.nz/papers/tidy-data.pdf) form, wherever +approapriate, for downstream analysis. + +The package is currently under active development. Currently, only +[EDA](https://support.mindwaretech.com/manuals/software/eda/3-2/) and +[HRV](https://support.mindwaretech.com/manuals/software/hrv/3-2/) data +from MindWare is supported. + +## TODO + +The development team considers the following for the package’s future: + + - Customizable data QA utilities, with meaningful defaults + - Common visualization schemes + - Study compilation utility + - Compatibility on data feeds from more vendors’ equipments ## Installation @@ -26,37 +44,3 @@ And the development version from [GitHub](https://github.com/) with: # install.packages("devtools") devtools::install_github("wendtke/psyphr") ``` - -## Example - -This is a basic example which shows you how to solve a common problem: - -``` r -library(psyphr) -#> Loading required package: magrittr -## basic example code -``` - -What is special about using `README.Rmd` instead of just `README.md`? -You can include R chunks like so: - -``` r -summary(cars) -#> speed dist -#> Min. : 4.0 Min. : 2.00 -#> 1st Qu.:12.0 1st Qu.: 26.00 -#> Median :15.0 Median : 36.00 -#> Mean :15.4 Mean : 42.98 -#> 3rd Qu.:19.0 3rd Qu.: 56.00 -#> Max. :25.0 Max. :120.00 -``` - -You’ll still need to render `README.Rmd` regularly, to keep `README.md` -up-to-date. - -You can also embed plots, for example: - - - -In that case, don’t forget to commit and push the resulting figure -files, so they display on GitHub\! From 481d056aa11ebd2372b89c1faedf4e7509aa8529 Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Sun, 26 May 2019 18:53:39 -0600 Subject: [PATCH 22/32] revise readme.rmd fix typos; add description and links --- README.Rmd | 13 ++++++++----- README.md | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/README.Rmd b/README.Rmd index a56ae59..90d790e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,30 +18,33 @@ knitr::opts_chunk$set( [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) -The `psyphr` R package turns [psychophysilology](https://en.wikipedia.org/wiki/Psychophysiology) lab data from proprietary equipments into a [tidy](http://vita.had.co.nz/papers/tidy-data.pdf) form, wherever approapriate, for downstream analysis. +The `psyphr` R package turns [psychophysiological](https://en.wikipedia.org/wiki/Psychophysiology) data from +proprietary data collection and processing systems into a [tidy](http://vita.had.co.nz/papers/tidy-data.pdf) form for downstream analysis +and visualization. -The package is currently under active development. Currently, only [EDA](https://support.mindwaretech.com/manuals/software/eda/3-2/) and [HRV](https://support.mindwaretech.com/manuals/software/hrv/3-2/) data from MindWare is supported. +The package is currently under active development. Currently, only [Electrodermal Activity](https://support.mindwaretech.com/manuals/software/eda/3-2/) and [Heart Rate Variability](https://support.mindwaretech.com/manuals/software/hrv/3-2/) output data from [MindWare Technologies](https://www.mindwaretech.com/) are supported. ## TODO The development team considers the following for the package's future: +- Submit `psyphr` to [rOpenSci](https://ropensci.org/) for peer review and publication - Customizable data QA utilities, with meaningful defaults - Common visualization schemes - Study compilation utility -- Compatibility on data feeds from more vendors' equipments +- Compatibility on data feeds from other popular data collection and processing systems (e.g., [BIOPAC](https://www.biopac.com/)) ## Installation -You can install the released version of psyphr from [CRAN](https://CRAN.R-project.org) with: +Install the released version of `psyphr` from [CRAN](https://CRAN.R-project.org) with: ``` r install.packages("psyphr") ``` -And the development version from [GitHub](https://github.com/) with: +Install the development version from [GitHub](https://github.com/) with: ``` r # install.packages("devtools") diff --git a/README.md b/README.md index a407468..bbc9edf 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,18 @@ experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](h The `psyphr` R package turns -[psychophysilology](https://en.wikipedia.org/wiki/Psychophysiology) lab -data from proprietary equipments into a -[tidy](http://vita.had.co.nz/papers/tidy-data.pdf) form, wherever -approapriate, for downstream analysis. +[psychophysiological](https://en.wikipedia.org/wiki/Psychophysiology) +data from proprietary data collection and processing systems into a +[tidy](http://vita.had.co.nz/papers/tidy-data.pdf) form for downstream +analysis and visualization. The package is currently under active development. Currently, only -[EDA](https://support.mindwaretech.com/manuals/software/eda/3-2/) and -[HRV](https://support.mindwaretech.com/manuals/software/hrv/3-2/) data -from MindWare is supported. +[Electrodermal +Activity](https://support.mindwaretech.com/manuals/software/eda/3-2/) +and [Heart Rate +Variability](https://support.mindwaretech.com/manuals/software/hrv/3-2/) +output data from [MindWare Technologies](https://www.mindwaretech.com/) +are supported. ## TODO @@ -27,7 +30,8 @@ The development team considers the following for the package’s future: - Customizable data QA utilities, with meaningful defaults - Common visualization schemes - Study compilation utility - - Compatibility on data feeds from more vendors’ equipments + - Compatibility on data feeds from other popular data collection and + processing systems (e.g., [BIOPAC](https://www.biopac.com/)) ## Installation From 393c9e00669b32215d622420e340af247185bfe4 Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 27 May 2019 11:57:36 -0600 Subject: [PATCH 23/32] remove audrey (by her request) and move siqi to 2nd --- DESCRIPTION | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2a50158..bc61db1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,14 +2,12 @@ Package: psyphr Title: wrangling psychophysiological data Version: 0.1.0.9000 Description: an R package to wrangle psychophysiological data from MindWare Technologies. -Authors@R: c(person("Kathleen E", "Wendt", email = "wendtke@colostate.edu", +Authors@R: c(person("Kathleen", "Wendt", email = "kathleen.wendt@colostate.edu", role = c("aut", "cre")), - person("Amanda", "Gadrow", email = "amanda@rstudio.com", - role = "aut"), - person("Audrey", "McCombs", email = "amccombs@iastate.edu", - role = "aut"), person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com", - role = "aut") + role = "aut") + person("Amanda", "Gadrow", email = "amanda@rstudio.com", + role = "aut") ) License: MIT + file LICENSE Encoding: UTF-8 From eb3f81bf70a9672a951ce850040b7f407141879a Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 18:31:15 -0600 Subject: [PATCH 24/32] remove Amanda from author list re-add if we retain her original code --- DESCRIPTION | 3 --- 1 file changed, 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bc61db1..e2bce5d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,9 +6,6 @@ Authors@R: c(person("Kathleen", "Wendt", email = "kathleen.wendt@colostate.edu", role = c("aut", "cre")), person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com", role = "aut") - person("Amanda", "Gadrow", email = "amanda@rstudio.com", - role = "aut") - ) License: MIT + file LICENSE Encoding: UTF-8 LazyData: true From 30f3fc7132197b5f5c529c6f352e037a6064c54c Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 18:32:49 -0600 Subject: [PATCH 25/32] add comma --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e2bce5d..8505c96 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,7 +5,7 @@ Description: an R package to wrangle psychophysiological data from MindWare Tech Authors@R: c(person("Kathleen", "Wendt", email = "kathleen.wendt@colostate.edu", role = c("aut", "cre")), person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com", - role = "aut") + role = "aut"), License: MIT + file LICENSE Encoding: UTF-8 LazyData: true From 34426f8ff85d5ccf6dbbdfa64b11ea109dc35d32 Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 18:38:18 -0600 Subject: [PATCH 26/32] fix typo --- .Rbuildignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.Rbuildignore b/.Rbuildignore index 76d1027..4e9a5a2 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,4 +1,4 @@ -^psyr\.Rproj$ +^psyphr\.Rproj$ ^\.Rproj\.user$ ^LICENSE\.md$ ^README\.Rmd$ From f5f10712fb364fbd7ec0ec99d2b88d43fefbf81c Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 18:49:57 -0600 Subject: [PATCH 27/32] adjust author section; add end bracket --- DESCRIPTION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8505c96..5307531 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,10 +2,10 @@ Package: psyphr Title: wrangling psychophysiological data Version: 0.1.0.9000 Description: an R package to wrangle psychophysiological data from MindWare Technologies. -Authors@R: c(person("Kathleen", "Wendt", email = "kathleen.wendt@colostate.edu", - role = c("aut", "cre")), +Authors@R: c(person("Kathleen", "Wendt", email = "kathleen.wendt@colostate.edu", + role = c("aut", "cre")), person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com", - role = "aut"), + role = "aut")) License: MIT + file LICENSE Encoding: UTF-8 LazyData: true From cc7c003f9a028e9761fbddd7c5ec04d680a99b02 Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 18:52:10 -0600 Subject: [PATCH 28/32] align code --- R/workbook_read_parse.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/R/workbook_read_parse.R b/R/workbook_read_parse.R index 7638c69..5c6491a 100644 --- a/R/workbook_read_parse.R +++ b/R/workbook_read_parse.R @@ -61,17 +61,20 @@ read_MW_workbook <- function(path, device_vendor = NULL){ #' @examples tidy_MW_EDA <- function(workbook){ # EDA Stats - workbook[[1]] <- workbook[[1]] %>% transpose_convert_colnames() + workbook[[1]] <- workbook[[1]] %>% + transpose_convert_colnames() # SCR Stats workbook[[2]] <- workbook[[2]] %>% first_row_to_colnames() # Editing Stats - workbook[[3]] <- workbook[[3]] %>% transpose_convert_colnames() + workbook[[3]] <- workbook[[3]] %>% + transpose_convert_colnames() # Settings - workbook[[4]] <- workbook[[4]] %>% df_to_vector() + workbook[[4]] <- workbook[[4]] %>% + df_to_vector() return(workbook) } From 52524c30e3549adc84f42d80f240a2e03d580de3 Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 19:49:44 -0600 Subject: [PATCH 29/32] delete random fig file with example plot (how did this happen?) --- man/figures/README-pressure-1.png | Bin 3744 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 man/figures/README-pressure-1.png diff --git a/man/figures/README-pressure-1.png b/man/figures/README-pressure-1.png deleted file mode 100644 index c092055f2d496ba61e9f3073c00bd2087bd1a77b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3744 zcmds4cTiL57LOQdLJ$E#L6EY5NQqd0NC_$eYfz-C6cLHUm7<80gc714O@g|FA|@(} zC`fS;5DmQ-6G0FOgqnb1Nq|6rfaG1=owqx)Z|3dW_s5%gcg~&jednBe?sw1c{Jw8) zg8eCLN%39cAP`8>*5O_AS4X9@HFH%9}uyJo{3CzC)tm=#HaZ9JLhciPdH(6D0PI!MOnR~l;_c^~o z&cnD(?fPmYO=IBuZF7@y#|F70E{r$Y^0p;+jJh6J%uo;q>a^*{Bh9QRS}gB+Y2YCu zju-Xpk^DZaEcLg!)TKoo?;~TBgk7vf$sV~~>eMw9k&JO#0(o3` zYeQRucf9TU(a5<|_|vFFl}E0B6p1l}>VU@w*eQm+waFGpFF-4W9jG&E{`5)G(8cR% z6-i~`o=vH`P#M6l$R**Kp^&PPn`wt@3YND3&J}l!OeTRDAdljj#P)3sGiF*!tH|5p zPmu7<=S_3NRV-5o--8ov*M`TWa2-m*L;BrJ6>TE2UTAGIgG+LY2?fg4e|`aXgBraa5X-|TYxlAzyqtMZPcGOLQ~-#(Ui=T>ZV|@ zm9{cg+0)$oQ^ALDDtj0g1QA!Pq2QQSF;BUq8c$nkZOyr@3-*m|rrJA3xI1cK0Ubw@ zW(!U=PKKmSJmNhY@*^TXswW#0MSPzqW1&EooMBqVYq2~o(*x9;fiXa{2gY0y5QMk+ zrX-k_s(Rg~ew8z0^jl=1yL`@=#V1_FH8rX=gBHF;Pfj2kU2V0bpT@K^0vCia7{s}5jNv$ zVjEk*yGhIFRWpZtz!_CztFzvD^}r%fL=4k%8kOf2Ew6$EFmG{QBl4+jh6mkZ1kyLA z(j~APus+1O5YJ@IqVo38tOg`x7W3Xj2sLSR;*RdZ{x@>5x@2Eha-h!g=0HQGblI?% zMP3zhybT6yy-v1}A8>0Gp*u*p{7^}5;W1c>&Ac_ z!3HdTKVN1so**T3+jcO4-;fCR-u^|YtZlw>H{VnSd-0y1>)c}Y8p@g!`uzlVdnazp z`XoIXC4n8&N}|^VY-sSVo5tW1B=7iReh+a+6c0JxPROZ}X&r=m_RvsgTQ zv-zxMgIR1^#Wf+x<=SkCP=gcicUY@qrlv_}(uB-r+!-s8%|TCHU-*35RDC+xa4Jxm zPfoFz525D&^T^Y&VTf@yQ$Hf-PreAe>nrlLgctYVduacx#g2vxG zm61QxbQTX!cwD})Sxh90O z5y?8TRA!W7Km6c^ui`Y9$Zd*z`=`G6$>A`Q{3UMxI_6d25$|1^tp&X@N2u@m zTL#OC#9}npt;IjY@oNB>@;J*Ifd*RobZa|-T4qG>zG^`%Tvqhp-15)ZR_x+60iUJ~ zsJNu>AK0QO;lo($J~brz=-8o#e%@5D2i=++X6cXak@TTukKc4O5B6RAe52u3*z2O> zkcD}l1;WchA4Y)V*TE|3wYV$sVkOp$(xytI8R#Znp6=Cu+ z%2OeMyY@9&b+5qeIc8V-CSJ4c`n>GAc-*}>@t`&ri{5uet_#mHSv4qncKTded8v9%E|j(Cov1TcxH*L$7>L)l{9=}| zo8HJPx~#zU<*G}b3*EP}6&gwoH2T4-kR@<1=k^Pqi+mQTR1Lf{1nKM4n^SDmWtUn& zBNGIN&?{5b9+B79elF(x7`c0jiP_04k5;z@vkDM})lDI9!IrDm!9?CoE5evy<~@u% zZ?+DjR&aeYXkYy=N#_^qQ2FMA?31M8nR~}(DyHE{GF_8`$Rn}UIR*`be2&H)c%;W& z(&Wi(FCqUL58r+>bT&)tNIndj6xx=$%)AY6MmZ5Ly$-4)_sbj6n-%+EB4NjIm z7-qk>B=UUY7zdJ^hP-IJ`RC!lms4jem89;#8`P;Wq6bZdB)=VxfB$c5CUD(esJc1` Szq;|KX=`=rc+t@dvHt+rJImPs From 1a4fe4b395182d94a06f9e69c4d065baad36409a Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 19:56:02 -0600 Subject: [PATCH 30/32] fix alignment and typo --- R/rename.R | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/R/rename.R b/R/rename.R index 32efd07..397cd37 100644 --- a/R/rename.R +++ b/R/rename.R @@ -1,12 +1,13 @@ #' Rename sheet columns after the sheet has been transformed. #' -#' Functions to change the column names to be easier to use by later analysis scripts. +#' Functions to change the column names to be easier to use by later analysis +#' scripts. #' They should only be called after transform_* has already been used. #' -#' TODO: add error handling in case this is run before transform_* has been run, -#' and the column names are not as expected. I.e., detect whether the second -#' column name is a number, and if so, -#' exit out gracefully with a message to run transform_* function first. +#' TODO: Add error handling in case this is run before transform_* has been run, +#' and the column names are not as expected - i.e., detect whether the second +#' column name is a number, and if so, exit out gracefully with a message +#' to run transform_* function first. #' #' @param sheet #' @@ -21,7 +22,7 @@ #' rename_hrv_stats_columns <- function(sheet){ sheet %>% - dplyr::rename(segment = `Segment Numbe`, + dplyr::rename(segment = `Segment Number`, start_time = `Start Time`, end_time = `End Time`, seg_length = `Segment Duration`, From c7d30c05afba6b8815dc606bf85d6edca62baa18 Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 20:01:14 -0600 Subject: [PATCH 31/32] delete period --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5307531..2da13e0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: psyphr Title: wrangling psychophysiological data Version: 0.1.0.9000 -Description: an R package to wrangle psychophysiological data from MindWare Technologies. +Description: an R package to wrangle psychophysiological data from MindWare Technologies Authors@R: c(person("Kathleen", "Wendt", email = "kathleen.wendt@colostate.edu", role = c("aut", "cre")), person("Siqi", "Zhang", email = "iqis.gnahz@gmail.com", From 4a4522bcdf3e00ce3cf0be342dc100b426a59d0e Mon Sep 17 00:00:00 2001 From: Kathleen Wendt Date: Mon, 10 Jun 2019 20:04:03 -0600 Subject: [PATCH 32/32] adjust fig path; add a few words --- README.Rmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.Rmd b/README.Rmd index 90d790e..b2c2626 100644 --- a/README.Rmd +++ b/README.Rmd @@ -8,7 +8,7 @@ output: github_document knitr::opts_chunk$set( collapse = TRUE, comment = "#>", - fig.path = "man/figures/README-", + fig.path = "figures/README-", out.width = "100%" ) ``` @@ -18,7 +18,7 @@ knitr::opts_chunk$set( [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) -The `psyphr` R package turns [psychophysiological](https://en.wikipedia.org/wiki/Psychophysiology) data from +The `psyphr` R package tranforms [psychophysiological](https://en.wikipedia.org/wiki/Psychophysiology) data from proprietary data collection and processing systems into a [tidy](http://vita.had.co.nz/papers/tidy-data.pdf) form for downstream analysis and visualization. @@ -30,8 +30,8 @@ The package is currently under active development. Currently, only [Electroderma The development team considers the following for the package's future: - Submit `psyphr` to [rOpenSci](https://ropensci.org/) for peer review and publication -- Customizable data QA utilities, with meaningful defaults -- Common visualization schemes +- Customizable data QA utilities with meaningful defaults +- Common, publication-grade visualization schemes - Study compilation utility - Compatibility on data feeds from other popular data collection and processing systems (e.g., [BIOPAC](https://www.biopac.com/))