Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

r modify and rebuild package

Tags:

package

r

rebuild

I'm trying to use the SemiMarkov package and I want to change one small line of code in there. I've done some digging via:

getAnywhere("semiMarkov")

& I've identified that I want to change this line:

hessian <- diag(ginv(hessian(V, solution)))

to try something like:

hessian <- diag(ginv(pracma::hessian(V, solution)))

How do I go about this? Do I need to rebuild the package from scratch, and if so do I need rTools etc for this, or is there a simple-ish workaround (I'm a relevant R novice)? I've done some searching online and can't find anything obvious. Any ideas/pointers gratefully appreciated.

like image 276
Rob Avatar asked Jan 14 '16 21:01

Rob


People also ask

What is R CMD check?

R CMD check automatically checks your code for common problems. It's essential if you're planning on submitting to CRAN, but it's useful even if you're not because it automatically detects many common problems that you'd otherwise discover the hard way.

What is the command for invoking packages in RStudio?

The RStudio Load All command (keyboard shortcut: Ctrl+Shift+L) calls the devtools load_all function for the current package.


1 Answers

If you'd like to simply test out the effect of that change in an interactive R session, you can do so using trace(). Here's how:

  1. Type trace("semiMarkov", edit=TRUE)
  2. In the text editor that that launches, edit the line of interest.
  3. Save the modified file.
  4. Close the text editor
  5. Back in R, use the modified function.
like image 160
Josh O'Brien Avatar answered Sep 22 '22 20:09

Josh O'Brien