Here you will find daily news and tutorials about R, contributed by over 573 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

The mathematical puzzle from the weekend edition of Le Monde from a few weeks ago was not too hard to solve by induction but my R code failed miserably! The puzzle was as follows:

A calculator is broken in such a way that it starts by exhibiting 0, then pressing 4, 6 or 0 keeps adding this figure to the right of the current number (if not zero), while pressing 2 divides the current number by 2. For instance, a possible sequence is

which unfortunately runs very quickly into problems as can be seen by calling

> check(7)
Error in if (ok < length(xdigits)) { :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In do.call(FUN, as.list(s[, j])) : NAs introduced by coercion
2: In do.call(FUN, as.list(s[, j])) : NAs introduced by coercion
3: In do.call(FUN, as.list(s[, j])) : NAs introduced by coercion