[R] Illustrating use of R package

Glenn Schultz glennmschultz at me.com
Sat May 16 03:04:27 CEST 2015

I have an R package Bond Lab which actually supports a book Investing in MBS using R and Open Source Computing.  The Bond Lab beta is stable.  I have also created a package companion to investing in MBS.  Both are on my Github site


I wrote the companion as functions for each chapter calling source code.  I really don't like the way it works presentation wise but the user could see the code used.  Further, the user must create a directory and copy the source into the directory.  Further the source runs all examples at once which seems a little confusion.  However, to illustrate a function for chapter example I think I have to make a function to call a function which does not make sense.

My first question, any suggestions on illustrating function call aside from the strategy I am using.  I am not a fan of what I am doing.

My second question regards on.load() vs. on.attach() Bond Lab needs to create the BondLab directory which installs in the BondLab library to the ~/users directory, the same for the companion.  

I think I should use on.load(), correct?
I am not sure how to do this and will the same function work for both Windows and MAC?  
Do I need different copy from path for Windows and MAC or can it be generic since the copy happens at load.
I would like to get Bond Lab on CRAN.  I read CRAN rules require a yes/no from the user to write a directory.  So, I need to write an on.load() function for both Bond Lab and the Companion.  Also, CRAN requires that a package works on at least two systems so I need to figure out the Windows build.  This leads to another question.

Can I somehow make a windows binary on a MAC?
If not, can I emulate Windows on a MAC and make a binary?  Seems like this may not be 100%.
Will I actually have to buy a windows machine to build the windows binary for CRAN?


More information about the R-help mailing list