diff --git a/NEWS.md b/NEWS.md index 44e36890..5e58a272 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,7 +5,9 @@ * Fixed bug in `summary()` where missing estimation method was reported if NM code written as METH=... instead of METHOD=... * Fixed bug where labels in `prm_table()`, `get_prm()` were missing with a commented row in $THETA, $OMEGA or $SIGMA * Fixed bug in `prm_table()`, `get_prm()` where only `NA` would be reported when missing the -1000000006 record in the .ext file (i.e. NM <7.3) +* Prevented negative RSE in `prm_table()` and `get_prm()` * Improved description of the `prm_table()` output +* Fixed bug in `summary()` with non numeric covariance step time * Fixed bug in `ind_plots()` where the aesthetics would get mixed up if the variable names were changed * Small fixes to vignettes, documentations and website diff --git a/R/summarise_nm_model.R b/R/summarise_nm_model.R index 3eccb159..bf810372 100644 --- a/R/summarise_nm_model.R +++ b/R/summarise_nm_model.R @@ -317,7 +317,7 @@ sum_runtime <- function(model, software) { if (software == 'nonmem') { x <- model %>% dplyr::filter(.$subroutine == 'lst') %>% - dplyr::filter(stringr::str_detect(.$code, stringr::fixed('Elapsed estimation time'))) + dplyr::filter(stringr::str_detect(.$code, 'Elapsed estimation\\s+time')) if (nrow(x) == 0) return(sum_tpl('runtime', 'na')) @@ -336,7 +336,7 @@ sum_covtime <- function(model, software) { if (software == 'nonmem') { x <- model %>% dplyr::filter(.$subroutine == 'lst') %>% - dplyr::filter(stringr::str_detect(.$code, stringr::fixed('Elapsed covariance time'))) + dplyr::filter(stringr::str_detect(.$code, 'Elapsed covariance\\s+time in seconds:\\s+\\d')) if (nrow(x) == 0) return(sum_tpl('covtime', 'na')) diff --git a/R/xpdb_access.R b/R/xpdb_access.R index e907a28f..5f1b334f 100644 --- a/R/xpdb_access.R +++ b/R/xpdb_access.R @@ -396,7 +396,7 @@ get_prm <- function(xpdb, stringr::str_detect(.$name, 'SIGMA') ~ 'sig'), number = stringr::str_replace_all(.$name, '[^\\d,]+', ''), se = ifelse(.$fixed, NA_real_, as.numeric(.$se)), - rse = ifelse(.$fixed, NA_real_, as.numeric(.$rse))) %>% + rse = ifelse(.$fixed, NA_real_, abs(as.numeric(.$rse)))) %>% tidyr::separate(col = 'number', into = c('m', 'n'), sep = ',', fill = 'right') %>% dplyr::mutate(diagonal = dplyr::if_else(.$m == .$n, TRUE, FALSE)) %>% dplyr::rename_(.dots = list(value = 'mean')) %>% diff --git a/tests/testthat/test-model-summary.R b/tests/testthat/test-model-summary.R index b8c76f77..525c03cb 100644 --- a/tests/testthat/test-model-summary.R +++ b/tests/testthat/test-model-summary.R @@ -71,6 +71,9 @@ test_that('summary default summary is returned for missing information', { expect_equal(sum_out(sum_subroutine(model2, software)), c('subroutine', 'na')) expect_equal(sum_out(sum_runtime(model2, software)), c('runtime', 'na')) expect_equal(sum_out(sum_covtime(model2, software)), c('covtime', 'na')) + expect_equal(sum_out(sum_covtime(model = dplyr::data_frame(problem = 1L, level = 1L, subroutine = 'lst', + code = 'Elapsed covariance time in seconds: ********', + comment = ''), software), 1), c('covtime', 'na')) expect_equal(sum_out(sum_term(model2, software)), c('term', 'na')) expect_equal(sum_out(sum_warnings(model2, software)), c('warnings', 'na')) expect_equal(sum_out(sum_errors(model2, software)), c('errors', 'na'))