Well, there are the 3 and 5 in column 1, just as should be the case.
Remember, column 1 here contains the information for row 1 ind,sowmins
is saying that the minimum value in row 1 is 5, occurring at index 3 of that
row, which is correct.
After taking another break, though, we realize that whilewminsis correct,
ouruseof it isn’t. We have the rows and columns of that matrix mixed up.
This code:
i <- which.min(wmins[1,])
j <- wmins[2,i]
should be like this:
i <- which.min(wmins[2,])
j <- wmins[1,i]
After making that change and resourcing our file, we try it out.
> mind(m)
[1]513
This is correct, and subsequent tests with larger matrices worked, too.
13.4 Moving Up in the World: More Convenient Debugging Tools...................
As just seen, R’s debugging tools are effective. However, they’re not very
convenient. Fortunately, there are various tools that make the process eas-
ier. In approximate chronological order of development, they are as follows:
- Thedebugpackage by Mark Bravington
•Myedtdbgpackage, which works with the Vim and Emacs text editors - Vitalie Spinu’sess-tracebug, which runs under Emacs (with the same
goals asedtdbgbut with more Emacs-specific features) - REvolution Analytics’ Integrated Development Environment (IDE)
NOTE As of this writing (July 2011), work is in progress by the teams that develop the
StatET and RStudio IDEs to add debugging tools.
All of these tools are cross-platform, working on Linux, Windows, and
Mac systems, with the exception of the REvolution Analytics product. That
IDE is available only on Windows systems with Microsoft Visual Studio. All of
the tools are open source or free, again with the exception of the REvolution
Analytics product.
So, what do these packages have to offer? To me, one of the biggest
problems with R’s built-in debugging tools is the lack of a window that shows
the big picture—a window displaying your R code with a cursor that moves
300 Chapter 13