Post navigation

Paper Snowflakes with R

It’s December. Perhaps it’s dark, cold, rainy, and not very snowy at the Bamfield Marine Sciences Centre. But that can’t stop you from making paper snowflakes. In fact, you don’t need paper. That’s right, you can make snowflakes with R. (See Figure 1.)

Figure 1. A snowflake made with R. Cut and past the R script given below, and make your own snowflake.

When you run the script provided below, a six-sided flake will appear in the graphics window, with fold lines for reference. Click on the graphics window. You will see a “+”. Click 3 times to cut a triangle out of the snowflake. You have 3 triangles to design your snowflake. (See Figure 2.) After you cut out the 3rd triangle, you get a snowflake! (At any time you can end your snowflake making session by closing the graphics window.)

How does it work? Matrix algebra. Matrices also have biological applications. See, for example, Caswell (2001).