From a138753d38b7265081134daf71b9cf4de154a76d Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Fernandes" Date: Mon, 25 Nov 2024 08:58:48 -0600 Subject: [PATCH 1/3] [bugfix] Fixed error in iglu::mage(., return_type='df') --- R/mage.R | 7 ++++++- man/mage.Rd | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/R/mage.R b/R/mage.R index 0ca31f10..aa3996e7 100644 --- a/R/mage.R +++ b/R/mage.R @@ -39,6 +39,7 @@ #' @examples #' data(example_data_5_subject) #' mage(example_data_5_subject, version = 'ma') +#' mage(example_data_5_subject, return_type='df') mage <- function(data, version = c('ma', 'naive'), @@ -87,7 +88,11 @@ mage_ma <- function(data, title = title, xlab = xlab, ylab = ylab, show_ma = show_ma, show_excursions = show_excursions, static_or_gui='ggplot')) # Check if a ggplot or number in list is returned - convert the latter to a number - if(class(out$MAGE[[1]])[1] == "numeric" | is.na(out$MAGE[[1]][1])) { + if(class(out$MAGE[[1]])[1] == "data.frame") { + # No processing on DataFrames is needed + out <- out + } + else if(class(out$MAGE[[1]])[1] == "numeric" | is.na(out$MAGE[[1]][1])) { out <- out %>% dplyr::mutate(MAGE = as.numeric(MAGE)) } # else must be ggplot output diff --git a/man/mage.Rd b/man/mage.Rd index e57db9fb..669436ba 100644 --- a/man/mage.Rd +++ b/man/mage.Rd @@ -79,6 +79,7 @@ If version \code{'ma'} is selected, the function computationally emulates the ma \examples{ data(example_data_5_subject) mage(example_data_5_subject, version = 'ma') +mage(example_data_5_subject, return_type='df') } \references{ Service et al. (1970) Mean amplitude of glycemic excursions, a measure of diabetic instability From d300b493963443c53d104dcbf6080ff964580a05 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Fernandes" Date: Mon, 25 Nov 2024 09:02:36 -0600 Subject: [PATCH 2/3] updated news --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 3e9b7985..69bae8dc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# iglu 4.2.1 +* Fixed bug in MAGE + # iglu 4.2.0 * Fixed bug in GRI calculation From a14d2b1e0aa73a25aebd298f794ec35a3fcb03a9 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Fernandes" Date: Mon, 25 Nov 2024 10:27:44 -0600 Subject: [PATCH 3/3] updated description version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8834c1a5..7dec3ecb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: iglu Type: Package Title: Interpreting Glucose Data from Continuous Glucose Monitors -Version: 4.2.0 +Version: 4.2.1 Authors@R: c(person("Elizabeth", "Chun", role = c("aut")), person("Steve", "Broll",