Site icon R-bloggers

Refactor

[This article was first published on R | Gianluca Baio, 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.

This is quite exciting: since Nathan (this is his very interesting blog) has arrived to UCL a couple of months ago, we’ve started to work on quite a few of very interesting projects — including a major “refactoring” of the code for BCEA. I’m obviously very attached to BCEA — it’s basically my first R package and one I’ve spent lots of time thinking about and then working on. And I think it’s usually very helpful to practitioners and I always push people around to try and get them to use it.

BUT: it’s more than fair to say that when I was thinking about the structure and then coding up the functions, I was not the best programmer — not that I am today, but I think I know a lot more what I’m doing now than I did a few years ago. Also, I do think that R has changed somewhat in the past few years, with the advent of the Rstudio crowd and then the various ideas they brought forward, including tidyverse and rmarkdown.

Anyway, Nathan has taken it upon himself (among quite a few other things…) to look at the code and essentially modernise and streamline all the functions and functionalities. Interestingly, at the user end, you probably don’t see many changes — the functions work as they did originally (ie the call is the same). But the underlying package is now in places a bit quicker and generally speaking a lot neater. We’ve also worked in response to a couple of requests for changes in the code — the changes are nearly ready and will feature our next major update.

For now, we’re working on the dev branch; you can still use the resulting updated package (which we’ve labelled as version 2.4), using the code

pkgs <- c("MASS","Rtools","devtools")
repos <- c("https://cran.rstudio.com", "https://inla.r-inla-download.org/R/stable")
install.packages(pkgs,repos=repos,dependencies = "Depends")

before installing the package using devtools:

devtools::install_github("giabaio/BCEA",ref="dev")

under MS Windows. Under Linux or MacOS, it is sufficient to install the package via devtools:

install.packages("devtools")
devtools:install_github("giabaio/BCEA",ref="dev")

(notice the option ref="dev" in the call to devtools:install_github to point to the relevant branch of the GitHub repository).

We’ll keep testing the changes and possibly bring in a couple of new features — particularly around the graphical representation of the outputs. And will post more as we have news!

To leave a comment for the author, please follow the link and comment on their blog: R | Gianluca Baio.

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.