-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Milestone
Description
The error messages are wonky for calculate(), in the event a user provides a greta array with unknown values:
library(greta)
#>
#> Attaching package: 'greta'
#> The following objects are masked from 'package:stats':
#>
#> binomial, cov2cor, poisson
#> The following objects are masked from 'package:base':
#>
#> %*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag,
#> eigen, forwardsolve, gamma, identity, rowMeans, rowSums, sweep,
#> tapply
# Error message mentions lapply?
# It says we need to provide values for a, but not that we could also set `nsim`
a <- normal(0, 1)
#> ℹ Initialising python and checking dependencies, this may take a moment.
#> ✔ Initialising python and checking dependencies ... done!
#>
calculate(a)
#> Error in `lapply()` at greta/R/calculate.R:407:5:
#> ! Please provide values for the following 1 <greta_array>:
#> `a`
#> Backtrace:
#> ▆
#> 1. └─greta::calculate(a)
#> 2. ├─base::with(...) at greta/R/calculate.R:162:3
#> 3. ├─reticulate:::with.python.builtin.object(...)
#> 4. │ ├─base::tryCatch(...)
#> 5. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 6. │ └─base::force(expr)
#> 7. └─greta:::calculate_list(...) at greta/R/calculate.R:247:7
#> 8. └─base::lapply(...) at greta/R/calculate.R:407:5
#> 9. └─greta (local) FUN(X[[i]], ...)
#> 10. └─rlang::abort(message = msg, call = call) at greta/R/checkers.R:732:5
# Error message mentions lapply?
# It says it can't find the name of an object, but not why it is looking for one.
# It also doesn't say that we could also set `nsim`
b <- 1 + normal(0, 1)
calculate(b)
#> Error in `lapply()` at greta/R/calculate.R:407:5:
#> ! The names of the missing <greta_array>s could not be detected
#> Backtrace:
#> ▆
#> 1. └─greta::calculate(b)
#> 2. ├─base::with(...) at greta/R/calculate.R:162:3
#> 3. ├─reticulate:::with.python.builtin.object(...)
#> 4. │ ├─base::tryCatch(...)
#> 5. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 6. │ └─base::force(expr)
#> 7. └─greta:::calculate_list(...) at greta/R/calculate.R:247:7
#> 8. └─base::lapply(...) at greta/R/calculate.R:407:5
#> 9. └─greta (local) FUN(X[[i]], ...)
#> 10. └─rlang::abort(message = msg, call = call) at greta/R/checkers.R:732:5Created on 2025-03-27 with reprex v2.0.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Monthly todo