• Accessible Web visuals and code with p5.js

    August 7, 2014  |  Coding

    p5 JavaScript library

    Visualization on the Web can be tricky for those unfamiliar with code. The new JavaScript library p5.js, developed by Lauren McCarthy and collaborators, aims to make your first steps easier and less painful.

    Using the original metaphor of a software sketchbook, p5.js has a full set of drawing functionality. However, you're not limited to your drawing canvas, you can think of your whole browser page as your sketch! For this, p5.js has addon libraries that make it easy to interact with other HTML5 objects, including text, input, video, webcam, and sound.

    The library follows some of the same philosophy as Processing — that is, straightforward to get up and running — and reimagines the implementation and approach for recent web technology. Even if you're not into programming, it's worth visiting if just to watch, listen, and interact with Dan Shiffman as he enthusiastically talks about the library.

  • Responsive data tables

    May 13, 2014  |  Coding

    responsive table

    Alyson Hurt for NPR Visuals describes how they make responsive data tables for their articles. That is, a table might look fine on a desktop but then it might be illegible on a mobile device. This is a start in making tables that work in more places.

  • Optimizing your R code

    May 9, 2014  |  Coding

    Hadley Wickham offers a detailed, practical guide to finding and removing the major bottlenecks in your R code.

    It's easy to get caught up in trying to remove all bottlenecks. Don't! Your time is valuable and is better spent analysing your data, not eliminating possible inefficiencies in your code. Be pragmatic: don't spend hours of your time to save seconds of computer time. To enforce this advice, you should set a goal time for your code and only optimise only up to that goal. This means you will not eliminate all bottlenecks. Some you will not get to because you've met your goal. Others you may need to pass over and accept either because there is no quick and easy solution or because the code is already well-optimized and no significant improvement is possible. Accept these possibilities and move on to the next candidate.

    This is how I approach it. Some people spend a lot of time optimizing, but I'm usually better off writing code without speed in mind initially. Then I deal with it if it's actually a problem. I can't remember the last time that happened though. Obviously, this approach won't work in all settings. So just use common sense. If it takes you longer to optimize than it does to run your "slow" code, you've got your answer.

  • Create a barebones R package from scratch

    May 6, 2014  |  Coding

    While we're on an R kick, Hilary Parker described how to create an R package from scratch, not just to share code with others but to save yourself some time on future projects. It's not as hard as it seems.

    This tutorial is not about making a beautiful, perfect R package. This tutorial is about creating a bare-minimum R package so that you don’t have to keep thinking to yourself, "I really should just make an R package with these functions so I don't have to keep copy/pasting them like a goddamn luddite." Seriously, it doesn't have to be about sharing your code (although that is an added benefit!). It is about saving yourself time. (n.b. this is my attitude about all reproducibility.)

    I need to do this. I've been meaning to wrap everything up for a while now, but it seemed like such a chore. Sometimes I even go back to my own tutorials for copy and paste action. Now I know better. And that's half the battle.

  • R for cats and cat lovers

    May 6, 2014  |  Coding

    Programmer catFollowing the lead of JavaScript for Cats by Maxwell Ogden, Scott Chamberlain and Carson Sievert wrote R for Cats. It's a playful introduction to R intended for those who have little to no programming experience.

    The bulk of it so far is a primer on data structures, and there's a little bit on functions and some dos and don'ts. It's stuff you should know before you get into more advanced tutorials.

    Mainly though: ooo look, kitty.

    Once you're done with that (It only takes about 30 minutes.), there are lots of other resources for getting started with R.

  • Introducing R to a non-programmer, in an hour

    January 7, 2014  |  Coding

    Biostatistics PhD candidate Alyssa Frazee was tasked with teaching her sister, an undergraduate in sociology, how to use R. She had only one hour.

    Once you load in a dataset, things start to get fun. We learned a whole bunch of stuff from this data frame, like how to do basic tabulations and calculate summary statistics, how to figure out if you have missing data, and how to fit a simple linear model. This part was pretty fun because my sister started leading the session: instead of me saying "I'm going to show you how to do this," it was her asking "Hey, could we make a scatterplot?" or "Do you think we could put the best-fit line on that plot?" I was really glad this happened — I hope it meant she was engaged and enjoying herself!

    This is the nice thing about R. There are so many built-in functions and packages that you can get something useful with a few lines of code, and you don't really even have to know what a function is to get started (although you should eventually). Then you can go as far down the rabbit hole as you want.

  • Live Coding Implemented

    March 19, 2012  |  Coding

    water

    Remember Bret Victor's live coding talk from last month? He presented an example where he would edit code on one side, and the corresponding visual would automatically update on the other side. It was instant feedback that could help in learning code. Gabriel Florit implemented the idea with D3, and it's called water. Edit on the right and the diagram updates on the left. Try clicking on a number and then holding down the Alt key (or option on the Mac) for slider goodness.

    Also, check out Daniel Hooper's interactive JavaScript editor, CodeBook. It's the same idea but a slightly different implementation.

    [via Waxy]

  • Programming gets you freedom to do what you want with data

    October 26, 2011  |  Coding

    After the vote

    Casey Reas and Chandler McWilliams asked visual designers why they write their own software and how it affects their process:

    The answers reflect the individuality of the designers and their process, but some ideas are persistent. The most consistent answer is that custom software is written because it gives more control. This control is often expressed as individual freedom. Another thread is writing custom software to create a precise realization for a precise idea. To put it another way, writing custom code is one way to move away from generic solutions; new tools can create new opportunities.

    Most of the interviewees are media artists, but there are a couple of names you'll recognize. My favorite, Amanda Cox, uses a Mad Libs metaphor:

    Mad Libs is a game where key words in a short story have been replaced with blanks. Players fill in the blanks with designated parts of speech (“noun”, “adverb”) or types of words (“body part”, “type of liquid”), without seeing the rest of the story. Occasionally, hilarity ensues, but no one really believes that this is an effective method for generating great literature.

    I'm looking at you, non-programming statistician.

    Update: The article isn't there anymore, so you can read the cached page for now.

  • Sorting algorithms demonstrated with Hungarian folk dance

    April 14, 2011  |  Coding

    Bubble sort dance

    We've seen sorting algorithms visualized and auralized, but now it's time to see them through the spirit of Hungarian folk dance. In a series of four videos (so far), folks at Sapientia University in Romania demonstrate how different sorting algorithms work with numbered people dancing around and arranging themselves from least to greatest.

    See them in action in the video below. This one is for Bubble-sort. They move with such zest.
    Continue Reading

  • Code to make your own movie barcodes available

    March 16, 2011  |  Coding

    Austin Powers - Jay Roach (1997)

    You know those compressed movie barcodes that we saw last week? Here's a Python script by Benoît Romito to make your own. Run a .avi format movie through, and voila. Free gift idea: digitize some old home movies and make a personalized barcode for your family.

  • Why everyone should learn programming

    October 28, 2010  |  Coding

    Daniel Shiffman, assistant professor at the NYU Interactive Telecommunications Program, talks programming, computation, data, and why everyone should learn programming in this interview by Mark Webster.

    It's not just about saving time. There are certain things you can discover and be creative with with computation that you can't by hand. They both go together.

    Watch the four-minute interview below. The excitement in Shiffman's voice alone might want to make you learn some Processing (which he wrote a useful book for).
    Continue Reading

  • How to Make Your Own Twitter Bot – Python Implementation

    November 5, 2008  |  Coding, Self-surveillance, Tutorials

    Following up on my post last week about using Twitter to track eating and weight, some of you voiced some interest in creating your own Twitter bot. This post covers how you can do that.

    The Gist of It

    Creating my own Twitter bot was pretty straightforward (much more than I thought it'd be), mostly because Twitter provides an API and the resources to make it that way.

    I wanted something really simple that I could play around with. I just wanted to be able to send a direct message to my Twitter bot, and from there, it would store my data. OK, so here are the basic steps I took:

    1. Create Twitter account for bot
    2. Turn on email notification for direct messages only
    3. Check email periodically for new direct messages
    4. Parse direct messages and store in database

    Continue Reading

Copyright © 2007-2014 FlowingData. All rights reserved. Hosted by Linode.