Skip to content

Commit

Permalink
Merge pull request #85 from guiastrennec/master
Browse files Browse the repository at this point in the history
Summary and get_prm fixes
  • Loading branch information
Benjamin authored Jan 3, 2018
2 parents 420e09c + 3df3da3 commit ea9c3ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions R/summarise_nm_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

Expand All @@ -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'))

Expand Down
2 changes: 1 addition & 1 deletion R/xpdb_access.R
Original file line number Diff line number Diff line change
Expand Up @@ -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')) %>%
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-model-summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit ea9c3ed

Please sign in to comment.