Blog Archives

Simulation metamodeling with GNU R

September 7, 2012
By
Simulation metamodeling with GNU R

I am one of the organizers of ESSA2013 conference that will take place in September 2013 in Warsaw, Poland. The conference scope is social simulation and in particular methods of statistical analysis of simulation output (metamodeling). As we have just issued Call for Papers for the conference so I decided to post a simple example of a metamodel.Recently I had...

Read more »

Exporting ctree object to Asymptote

August 25, 2012
By
Exporting ctree object to Asymptote

When producing regression or classification trees (standard rpart or ctree from party package) in GNU R I am often unsatisfied with the default plots they produce. One of many possible solutions is to export a tree plot to Asymptote.The ...

Read more »

An example of OOP in GNU R using S4 Classes

August 18, 2012
By
An example of OOP in GNU R using S4 Classes

Recently I have discussed with my friend from WLOG Solutions an implementation of banking cash management engine in GNU R. The code made a nice use of S4 classes so I thought it would be worth showing as an example.The problemEvery commercial bank need...

Read more »

Animation basics for a vacation

August 5, 2012
By
Animation basics for a vacation

Since I have a vacation this time I decided to implement some entertaining graphics. I have chosen to animate a Cassini oval.The task is can be accomplished using polar equation:The implementation of the animation is given by the following code:library...

Read more »

Changing function scope in GNU R example

July 26, 2012
By

In my last post I have discussed how to work around GNU R scoping rules using environment function. This time let us look at a practical example using recode function from car package.First let us look at how&nbs...

Read more »

Emulating dynamic scoping in GNU R

July 21, 2012
By

By design GNU R uses lexical scoping. Fortunately it allows for at least two ways to simulate dynamic scoping.Let us start with the example code and next analyze it:x <- "global"f1 <- function() cat("f1:", x, "\n")f2 <- function() cat("f2:", e...

Read more »

Solving mastermind with R

June 29, 2012
By

In my last post I have shown a solution to classical sorting problem in R. So I thought that this time it would be nice to generate a strategy for playing Mastermind using R.It was shown by D.E. Knuth that Mastermind code can be bro...

Read more »

Optimal sorting using rpart

June 24, 2012
By
Optimal sorting using rpart

Some time ago I read a nice post Solving easy problems the hard way where linear regression is used to solve an interesting puzzle. Following the idea I used rpart to find optimal decision tree sorting five elements.It is well known that...

Read more »

You should not use split in production code

June 7, 2012
By

Recently I have stumbled on a problem with split function applied on list of factors. The issue is that it might produce wrong splits when splitting factors contain dots.Here is the example of the problem. Invoking the following code:df <-...

Read more »

Visualizing car brand choices in ggplot2

June 2, 2012
By
Visualizing car brand choices in ggplot2

I always like to read new posts at chartsnthings as they always inspire me with new ideas for data visualization. Yesterday I have read an article on choices of car brands by members of parliament in Poland in Gazeta.pl. It contains a simple ...

Read more »