Skip to content

Instantly share code, notes, and snippets.

@i2pi
Created March 22, 2012 03:36
Show Gist options
  • Select an option

  • Save i2pi/2155443 to your computer and use it in GitHub Desktop.

Select an option

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

yihui commented Mar 23, 2012

Copy link
Copy Markdown

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

i2pi commented Apr 18, 2012

Copy link
Copy Markdown
Author

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

@BrianDiggs

Copy link
Copy Markdown

You are welcome. Enjoyed the talk last night.

@i2pi

i2pi commented Oct 31, 2013

Copy link
Copy Markdown
Author

img

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