Skip to content

Commit

Permalink
Merge pull request #175 from Nathaniel-Fernandes/master
Browse files Browse the repository at this point in the history
[bugfix] Fixed error in iglu::mage(., return_type='df')
  • Loading branch information
irinagain authored Nov 25, 2024
2 parents f543255 + a14d2b1 commit 9dbfe1b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# iglu 4.2.1
* Fixed bug in MAGE

# iglu 4.2.0
* Fixed bug in GRI calculation

Expand Down
7 changes: 6 additions & 1 deletion R/mage.R
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions man/mage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9dbfe1b

Please sign in to comment.