From 1da7f486faac7623b41cb766754ea6485d05eab6 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 4 Aug 2021 17:43:51 +0200 Subject: [PATCH] Bugfix release v1.0.2 Fix automatic detection of file name in all "file_" functions #9 --- R/file_acceleration.R | 7 +++---- R/file_clean.R | 7 +++---- R/file_velocity.R | 7 +++---- README.md | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/R/file_acceleration.R b/R/file_acceleration.R index 35d9647..806a25b 100644 --- a/R/file_acceleration.R +++ b/R/file_acceleration.R @@ -21,12 +21,11 @@ file_acceleration <- function(file, model, fps = 25) { # Check whether file name contains information about model # If file was created by create_csv() then it should if(missing(model)) { - if(as.logical(grep("_body25", file))==TRUE) { + if(grepl("_body25", file)==TRUE) { model <- "body25" - } else if(as.logical(grep("_hand_left", file))==TRUE | as.logical( - grep("_hand_right", file))==TRUE ) { + } else if(grepl("_hand_left", file)==TRUE | grepl("_hand_right", file)==TRUE ) { model <- "hands" - } else if(as.logical(grep("_face", file))==TRUE) { + } else if(grepl("_face", file)==TRUE) { model <- "face" } else { stop("Argument \"model\" must be specified. Tell me from which model the data came from (body25, hands, or face).", call. = FALSE) diff --git a/R/file_clean.R b/R/file_clean.R index a7696aa..182259b 100644 --- a/R/file_clean.R +++ b/R/file_clean.R @@ -20,12 +20,11 @@ file_clean <- function(file, model, cutoff = 0.1, overwrite = TRUE) { # Check whether file name contains information about model # If file was created by create_csv() then it should if(missing(model)) { - if(as.logical(grep("_body25", file))==TRUE) { + if(grepl("_body25", file)==TRUE) { model <- "body25" - } else if(as.logical(grep("_hand_left", file))==TRUE | as.logical( - grep("_hand_right", file))==TRUE ) { + } else if(grepl("_hand_left", file)==TRUE | grepl("_hand_right", file)==TRUE ) { model <- "hands" - } else if(as.logical(grep("_face", file))==TRUE) { + } else if(grepl("_face", file)==TRUE) { model <- "face" } else { stop("Argument \"model\" must be specified. Tell me from which model the data came from (body25, hands, or face).", call. = FALSE) diff --git a/R/file_velocity.R b/R/file_velocity.R index 556ff66..2bfc85d 100644 --- a/R/file_velocity.R +++ b/R/file_velocity.R @@ -21,12 +21,11 @@ file_velocity <- function(file, model, fps = 25) { # Check whether file name contains information about model # If file was created by create_csv() then it should if(missing(model)) { - if(as.logical(grep("_body25", file))==TRUE) { + if(grepl("_body25", file)==TRUE) { model <- "body25" - } else if(as.logical(grep("_hand_left", file))==TRUE | as.logical( - grep("_hand_right", file))==TRUE ) { + } else if(grepl("_hand_left", file)==TRUE | grepl("_hand_right", file)==TRUE ) { model <- "hands" - } else if(as.logical(grep("_face", file))==TRUE) { + } else if(grepl("_face", file)==TRUE) { model <- "face" } else { stop("Argument \"model\" must be specified. Tell me from which model the data came from (body25, hands, or face).", call. = FALSE) diff --git a/README.md b/README.md index cf82c33..7c68989 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ For details on what OpenPoseR can (and can't) do, respectively, how you can use ## Installation -For now, OpenPoseR (current version: 1.0.1) can be installed using the following commands (you will need to have the ``devtools`` package installed): +For now, OpenPoseR (current version: 1.0.2) can be installed using the following commands (you will need to have the ``devtools`` package installed): ```r # Install devtools from CRAN (if not already installed)