UUPharmacometrics / xpose

Graphical diagnostics for pharmacometric models
https://uupharmacometrics.github.io/xpose
GNU Lesser General Public License v3.0
55 stars 28 forks source link

prm_distrib Fails when Parameter Has Parentheses #116

Closed billdenney closed 5 years ago

billdenney commented 6 years ago

One of my parameters is named "ETA(CL)", and this appears to cause the following error:

prm_distrib(xpdb=xpdb)
Error in ETA(CL) : could not find function "ETA"

The traceback() suggests it's an issue with attempting to map a column name to a function for summarization:

> traceback()
18: .f(.x[[i]], ...)
17: map(.x[sel], .f, ...)
16: map_if(ind_list, is_helper, eval_tidy)
15: vars_select_eval(.vars, quos)
14: tidyselect::vars_select(names(.data), !!!quos(...))
13: select.data.frame(.data, !!!dots)
12: select(.data, !!!dots)
11: select_.data.frame(., .dots = cols)
10: dplyr::select_(., .dots = cols)
9: function_list[[i]](value)
8: freduce(value, `_function_list`)
7: `_fseq`(`_lhs`)
6: eval(quote(`_fseq`(`_lhs`)), env, env)
5: eval(quote(`_fseq`(`_lhs`)), env, env)
4: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3: get_data(xpdb, .problem = .problem) %>% dplyr::select_(.dots = cols) %>% 
       dplyr::select_if(.predicate = function(x) length(unique(x)) == 
           1) %>% colnames()
2: drop_fixed_cols(xpdb, .problem, cols = prm_col, quiet = quiet)
1: prm_distrib(xpdb = xpdb)

In my NONMEM model, I'm using:

$ABBR REPLACE ETA(CL)=ETA(2)
billdenney commented 6 years ago

A workaround is to not use parentheses in the parameter naming:

Not this:

$ABBR REPLACE ETA(CL)=ETA(2)

But this:

$ABBR REPLACE ETA_CL=ETA(2)
bguiastr commented 6 years ago

I have seen this error in the past when importing the .ext and .phi files that contain ETA(1), OMEGA(1,1), SIGMA(1,1) and THETA(1), etc. but it was solved by a dplyr update. Are you using the latest tidyverse version? If yes could you please send me a reprex (you can PM me)?

billdenney commented 6 years ago

I'm on dplyr 0.7.6. I'll look into making a reprex.

bguiastr commented 5 years ago

related to #125 ?!

billdenney commented 5 years ago

It is almost definitely the same issue. If it happens again with the patch for #125, I’ll reopen this issue or start a new one.