I would like to extract some names of variable using regular expressions. The names I will extract are "r_Year[2007,KineticEnergy]","r_Year[2008,KineticEnergy]","r_Year[2009,KineticEnergy]","r_Year[2010,KineticEnergy]","r_Year[2011,KineticEnergy]".
I tried to the below code, but the error showed "Error in stopifnot(is.character(explicit), is.character(patterns), is.character(complete_pars)) : attempt to apply non-function"
library(bayesplot)
ma <- mcmc_intervals(
bmodel,
# pars = "$r_Year",
regex_pars = 20(07|08|09|10|11)+",KineticEnergy]",
prob = 0.80,
point_est = "mean",
prob_outer = 1,
outer_size = 0.2,
point_size = 3,
)
Thanks in advance,