nimble-dev / nimble

The base NIMBLE package for R
http://R-nimble.org
BSD 3-Clause "New" or "Revised" License
158 stars 24 forks source link

`getParam` gives incorrect error msg if applied to non-existent node #1338

Closed paciorek closed 5 months ago

paciorek commented 1 year ago
code= nimbleCode({
    y[2] ~ dnorm(0,1)
})
m <- nimbleModel(code)
getParam(m,'y[1]','mean')
Error in getParam(m, "y[1]", "mean") : 
  getParam only works for one node at a time, but y[1] includes multiple nodes.
paciorek commented 5 months ago

Problem is that we check if there is not one node but don't distinguish 0 nodes from >1 nodes.

Fixing this on devel to give an accurate error msg.