metrumresearchgroup / mrgsolve

Simulate from ODE-based population PK/PD and QSP models in R
https://mrgsolve.org
GNU General Public License v2.0
131 stars 36 forks source link

Error when trying to update with single non-updatable item #1237

Open kylebaron opened 2 months ago

kylebaron commented 2 months ago

Can't believe we never ran into this before:

library(mrgsolve)
#> 
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#> 
#>     filter

code <- '
$SET a = 2
'
mod <- mcode("foo", code, compile = FALSE)
#> Error in a[valid] <- all_updatable[m[valid]]: replacement has length zero

Created on 2024-09-23 with reprex v2.1.1

But this works

library(mrgsolve)
#> 
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#> 
#>     filter

code <- '
$SET 
a = 2
end = 24
'
mod <- mcode("foo", code, compile = FALSE)

Created on 2024-09-23 with reprex v2.1.1