Publications by Martin Scharm
Export R data to tex code
We often use Gnu R to work on different things and to solve various exercises. It’s always a disgusting job to export e.g. a matrix with probabilities to a document to send it to our supervisors, but Rumpel just gave me a little hint. The trick is called xtable and it can be found in the deb repository: 1aptitude install r-cran-xtable It’s ...
963 sym 2 img 2 tbl
Reassembling logical operations on boolean vectors in Gnu R
What a headline.. It’s about combining boolean vectors in R. I just had some problems with computing a boolean vector as a result of applying AND to two boolean vectors: 1234> x c(FALSE, TRUE, FALSE) > y c(TRUE, TRUE, FALSE) > x&&y [1] FALSE As you can see, it’s a nice result, but not what I want.. My hack was the following: 123456> # logi...
779 sym 3 tbl
Welcome Rumpel!
Ladies and gentlemen, waiting is finally over. I’m proud to introduce Rumpel! After more than one year of high frequently power of persuasion he finally set up his own blog named RforRocks. A few minutes after release there are even lots of myths surrounding the origin of that name. May it stand for: 123456789‘R’umpel ‘F’rees ‘O’rd...
842 sym 1 tbl
ShortCut[R]: locator
Welcome to my new category: ShortCut! Here I’ll shortly explain some smart features, unknown extensions or uncommon pathways of going for gold. Today it’s about the Gnu R tool locator. With locator you are able to detect the mouse position inside you plot. Just run locator() and click some points, when you’re finished click the right butto...
1069 sym 2 img 1 tbl
Homage to floating points
I recently got very close to the floating point trap, again, so here is a little tribute with some small examples! Because Gnu R is very nice in suppressing these errors, all examples are presented in R. Those of you that are ignorant like me, might think that 0.1 equals 0.1 and expect 0.1==0.1 to be true, it isn’t! Just see the following: 123...
1989 sym 5 tbl
Value of an R object in an expression
Just wanted to create an expression, existing of some mathematical annotation and a value of an R object. Wasn’t that intuitive! Each single goal is easy to reach, for example to combine a value of an R object with text just use paste: 123> n = 5 > paste (“n=”, n, “!”) [1] “n= 5 !” To have a plot title with an you can use expressi...
1452 sym 2 img 5 tbl
Vim plugin for R
Just found a very nice plugin for using R in Vim. It’s unbelievable comfortable! There are at least two ways to install it. If your are working on a Debian based distro you can use the .deb package provided by the author Jakson Alves de Aquino itself. On this site you’ll also find some smart screen shots. Another way is the installation by h...
1771 sym 2 img 2 tbl
web content anlayzer
Just developed a small crawler to check my online content at binfalse.de in terms of W3C validity and the availability of external links. Here is the code and some statistics… The new year just started and I wanted to check what I produced the last year in my blog. Mainly I wanted to ensure more quality, my aim was to make sure all my blog con...
3353 sym 2 img 8 tbl
Damn scoping in R
Ok, R is very well-considered in certain respects, but there are also some things annoying me… This time it’s scoping… Let’s have a look to the following code: 123456fun=function() { if (runif(1) > .5) x = 1 x } First it looks damn unspectacular. But wait, whats that: 12345> x=0 > fun() [1] 1 > fun() [1] 0 Taking ...
974 sym 3 tbl
Readability vs speed in R
I have bad news for those of you trying to produce lucid code! In his blog Radford M. Neal, Professor at the University of Toronto, published an article with the headline Two Surprising Things about R. He worked out, that parentheses in mathematical expression slow down the run-time dramatically! In contrast it seems to be less time consuming to...
1400 sym 1 tbl