Skip to content

Instantly share code, notes, and snippets.

@i2pi
Created March 22, 2012 03:36
Show Gist options
  • Save i2pi/2155443 to your computer and use it in GitHub Desktop.
Save i2pi/2155443 to your computer and use it in GitHub Desktop.
sierpinski
s=embed(rt(5,1),2);plot(t(replicate(1e4,s[4,]<<-(s[4,]+s[sample(3,1),])/2)),cex=.1)
@yihui
Copy link

yihui commented Mar 23, 2012

looks like you are trying to make the shortest R code ever to draw sierpinski triangle... I did not know embed() before. Great tips!

@i2pi
Copy link
Author

i2pi commented Apr 18, 2012

runif(1,1,4) --> sample(3,1) thanks to Brian!!

@BrianDiggs
Copy link

You are welcome. Enjoyed the talk last night.

@i2pi
Copy link
Author

i2pi commented Oct 31, 2013

img

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment