« Pairwise-complete correlation considered dangerous | Main | Fishing for packages in CRAN »

June 17, 2015

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

In the first block of code one can replace the for-loop at the end with recursion using a function such as:
iterplt<-function(x,n) { if (n>0){
polygon(x[,1], x[,2], border="lightblue",col=cols[nsteps -n+1]);
return(iterplt((x * scale) %*% rotate(angle),n-1))}
}
...
plot.new()
par(mai = rep(0.1, 4))
plot(x = range, y = range, type = "n", bty = "n", xaxt = "n",yaxt="n", xlab = NA, ylab=NA)
iterplt(X,nsteps)

Where the functions, functions, values and parameters are as originally defined.

Very nice, thank you.

Andrie

The comments to this entry are closed.

Search Revolutions Blog




Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr
‚Äč