Is there a way to access the arguments of an R6 method?
For example, I can access the arguments of rstan::stan()
with:
library(rstan)
formalArgs(rstan::stan)
#> [1] "file" "model_name" "model_code" "fit"
#> [5] "data" "pars" "chains" "iter"
#> [9] "warmup" "thin" "init" "seed"
#> [13] "algorithm" "control" "sample_file" "diagnostic_file"
#> [17] "save_dso" "verbose" "include" "cores"
#> [21] "open_progress" "..." "boost_lib" "eigen_lib"
However, the cmdstanr
uses R6 classes.
So I can see all of the arguments for the $sample()
method by looking at
the accompanying help page (``?cmdstanr::model-method-sample\
``).
But I can’t seem to find a way to access the arugments in the same way.
For example, this fails:
# remotes::install_github("stan-dev/cmdstanr")
library(cmdstanr)
formalArgs(cmdstanr::`model-method-sample`)
#> Error: 'model-method-sample' is not an exported object from 'namespace:cmdstanr'
Is there a way to access the formal arguments of an R6 method?
Created on 2021-11-22 by the reprex package (v2.0.1)