How to debug within R

In my words this is how to debug within R:

  • If you want to print a stack trace for the most recent exception
    • then use traceback
    • you may or may not have the source
  • If you want to set a breakpoint at a specific location in the code
    • then use browser
    • you must have the source
    • it may be conditional
  • If you want to set a breakpoint on a function at its
    entry point

    • then use debug
    • you may or may not have the source
    • delegates work to browser
  • If you want to install a global exception handler that will immediately start
    debugging

    • then use recover
    • you may or may not have the source
  • If you want to add watch statement to a function
    • then use trace
    • you may or may not have the source

Package management in R

Once you start using different versions of packages for different projects
then you will probably want a package-management solution for R. Or perhaps
you are coming from another language that had a package-management solution
that you were already happy with. Curious about the offerings I searched
and found two options, rbundler and Packrat. Having read the literature for both,
they seem to be more than adequate providing everything that one would expect.

Package Github CRAN PDF
rbundler here here here
Packrat here NA NA

My current approach is to install all packages into my user directory so as not
to spoil the global package cache. Most likely that approach won’t scale for
larger projects, so when the need arises I will migrate to one of these
solutions.

If you’ve never used something like this before, then you will be well-served to
first becomes comfortable and masterful managing it yourself before automating
it.

Whatever your approach, it is a real treat to know that both solutions are
available for when you embrace reproducible research.

Ultra-lightweight-reproducibility for R: which version of R that you used

Here is another post from the realm of ultra-lightweight-reproducibility for R:

If are going to get serious about locking down your system then only let it run
on the version of R that you personally used to obtain your results!

It takes very, very little effort:

stopifnot(R.version$major==3 && R.version$minor==1.1)

99% of the time, using a newer version won’t matter, but make it crystal clear
both to yourself and your collaborators how you obtained your results, at least
when it comes to which version of R that you used.

How Yoga Makes You A Fill-In-The-Blank Person

After doing some practice you will surely think that yoga is making you a fill in the blank person. If you don’t think it, then you will read it. If you don’t read it then someone will tell you it. That is OK.

Just know that it isn’t making into anything!

Rather, it is helping you return to that which you already are.

A database on your desktop?

If your business users utilize data that is critical to their success then you need to help provide a pleasant way for them to manage that data. GUI tabular data management programs like MS Excel and LibreOffice or OpenOffice are obvious choices for their ease of use alone. In practice, that ease of use is guaranteed to cause problems for them down the road, and usually at horrible times. Wondering what is a good option if you just stuck with CSV data, I posted here. The replies were informative and helpful, and my take away is that the best option for managing tabular data, if you are not bound to the applications mentioned above, is to use a database… no surprise. How do you do that though while still making it easy for the business and at a reasonable cost? The answer is SQLite.

It uses files that you may share and version. It is a real RBDMS. It runs on every OS. There are graphical management tools. It works well with R.

In practice, there are important details, and it is great to know that there is a realistic and practical solution to manage those details.

Who ever got fired for compiling code?

Q. How do you fix a memory corruption in S-PLUS?
A. Use R.

The IBM AS/400 is an application-platform consisting of custom hardware, an operating system, and database. It is a quite interesting system giving you literally everything that you need to develop a custom computing environment for a company immediately “out of the box”.

Working to deploy a pretty typical Java based system with DB2 and WebSphere backing it up, my co-worker and I ran into a bug with the JVM. The issue revolved around the fact that the web-application layer utilized a byte-code engineering library that resulted in the revelation of a bug in the JVM itself. First level support explained that it was our bug so we provided a stand-alone example in straight Java and that got us to second level support.

They explained that they would look into it and that that we should watch for a release note in the next version of OS/400. This was getting kind of silly so our department wanted to cash-in in one of their immediate-support “get out of jail free cards” that you get when you spend hundreds-of-thousands-of-dollars per quarter for IBM support. That got us to third level support.

Upon reviewing the issue that we researched, tracked down the exact situation where the bug occurred, and demonstrated a reproducible example, they expertly agreed that there was indeed a bug in their JVM, that they would have it fixed for the next release six months from now, and thanks for letting them know.

One of the value-adds of purchasing something from IBM is that every C-level knows that you can’t get fired for buying IBM. Something that you can’t have done either apparently is computing Java! 😛