Site icon R-bloggers

jagsAddIn: an RStudio AddIn

[This article was first published on R – Nathan Green, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I have been aware of the RStudio AddIns for a while now but never really saw the usefulness in them (see here https://rstudio.github.io/rstudioaddins/). To me the benefit of using RStudio is so coding in R is more fun and including more menus and clicking and taking away from the keyboard seemed like a step backwards. I know that some of my VIM colleagues would agree!

However, I came across this GitHub Repo which is an AddIn of AddIns. That is, it has a list of lots of them (https://github.com/daattali/addinslist). What I found potentially useful was those that auto-generate some template code, like the generate Roxygen code from functions does in the dropdown menu.

To this end, I’ve written a small AddIn myself which generates some code for running jags from R. Each session in which I do this more or less uses the same boilerplate code and so I realised that this could actually be useful. Its something like this:

cat("model { for (i in 1:N) { }") data <- list("fdfd") params <- list("fdfd") nc <- 1 ns <- 1000 nb <- 100 nt <- 1 bug_out <- bugs(data = dat, inits = inits, parameters.to.save = params, n.chains = nc, n.iter = ns, n.burnin = nb, n.thin = nt, DIC = TRUE working.directory = getwd)

I have since had my AddIn included in the addinslist table so you can see for yourself if it is in fact useful. Visit here https://github.com/n8thangreen/jagsAddIn.

To leave a comment for the author, please follow the link and comment on their blog: R – Nathan Green.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.