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

[bugfix] Fixed error in iglu::mage(., return_type='df') #175

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@
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

Check warning on line 93 in R/mage.R

View check run for this annotation

Codecov / codecov/patch

R/mage.R#L93

Added line #L93 was not covered by tests
}
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.

Loading