Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Siqi_scratch #16

Merged
merged 32 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a5cbbd8
corrected Auhtors@R format, removed duplicate field
iqis May 2, 2019
5288a66
psyr -> psyphr
iqis May 2, 2019
aeec5cb
version number 0.1.0.9000
iqis May 2, 2019
616b42c
add Siqi to Author
iqis May 2, 2019
8926463
delete example file from R/
iqis May 2, 2019
ff1b150
typos, etc
iqis May 2, 2019
201dc19
typo, formatting, etc
iqis May 2, 2019
8159fa1
reading and parsing functions
iqis May 2, 2019
98f2ae6
deleted original functions
iqis May 2, 2019
aa5829d
ro man
iqis May 2, 2019
be66fa2
DESC: siqi role -> Author
iqis May 2, 2019
22b3d95
depends magrittr
iqis May 2, 2019
543fded
imports purrr
iqis May 2, 2019
2d6aed6
fixin stuff: explicit symbol qualification
iqis May 2, 2019
883714b
add bare_name()
iqis May 2, 2019
e8ef9ed
renaming stuff
iqis May 2, 2019
520ce64
del: all tests
iqis May 2, 2019
a40e89b
ro man
iqis May 2, 2019
dd7b51b
initiate README
iqis May 6, 2019
8c39fc6
lifecycle: experimental
iqis May 6, 2019
5cb351d
tidbits for README
iqis May 6, 2019
481d056
revise readme.rmd
May 27, 2019
393c9e0
remove audrey (by her request) and move siqi to 2nd
May 27, 2019
eb3f81b
remove Amanda from author list
Jun 11, 2019
30f3fc7
add comma
Jun 11, 2019
34426f8
fix typo
Jun 11, 2019
f5f1071
adjust author section; add end bracket
Jun 11, 2019
cc7c003
align code
Jun 11, 2019
52524c3
delete random fig file with example plot (how did this happen?)
Jun 11, 2019
1a4fe4b
fix alignment and typo
Jun 11, 2019
c7d30c0
delete period
Jun 11, 2019
4a4522b
adjust fig path; add a few words
Jun 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
^psyr\.Rproj$
^psyphr\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
29 changes: 12 additions & 17 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
Package: psyphr
Title: wrangling psychophysiological data
Version: 0.1.0
Authors@R:
c(person(given = "Kathleen E",
family = "Wendt",
role = c("aut", "cre"),
email = "[email protected]")
person(given = "Amanda")
Description: an R package to wrangle psychophysiological data from MindWare Technologies.
Authors@R: c(person("Kathleen E", "Wendt", email = "[email protected]",
role = c("aut", "cre")),
person("Amanda", "Gadrow", email = "[email protected]",
role = "aut")),
person("Audrey", "McCombs", email = "[email protected]",
role = "aut")
Version: 0.1.0.9000
Description: an R package to wrangle psychophysiological data from MindWare Technologies
Authors@R: c(person("Kathleen", "Wendt", email = "[email protected]",
role = c("aut", "cre")),
person("Siqi", "Zhang", email = "[email protected]",
role = "aut"))
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:
testthat
Imports:
dplyr,
tidyr,
readxl
readxl,
purrr
Depends:
magrittr
9 changes: 5 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 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)
export(bare_name)
export(read_MW_EDA)
export(read_MW_workbook)
export(rename_hrv_stats_columns)
export(tidy_MW_EDA)
30 changes: 0 additions & 30 deletions R/editing.R

This file was deleted.

17 changes: 0 additions & 17 deletions R/example_file_grab.R

This file was deleted.

47 changes: 0 additions & 47 deletions R/files.R

This file was deleted.

10 changes: 0 additions & 10 deletions R/grab_files.R

This file was deleted.

10 changes: 0 additions & 10 deletions R/grab_sheets.R

This file was deleted.

148 changes: 67 additions & 81 deletions R/rename.R
Original file line number Diff line number Diff line change
@@ -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
#'
Expand All @@ -19,94 +20,79 @@
#' 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 Number`,
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`)
}


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`)
}
23 changes: 0 additions & 23 deletions R/settings.R

This file was deleted.

Loading