• fullscreen
  • ct_00.pde
  • void setup(){
      size(800, 600);  
      background(255);  
      colorMode(HSB);  //Hue, Saturation, Brightness
      
      //load the table
      String[] myTable = loadStrings("manhattan_garbage_collection.tsv");
      
      //Any row, just to get the number of columns
      String[] tempRow = split(myTable[0], '\t');
      
      //Looping through all the columns of the table
      for(int i = 2; i < tempRow.length; i++){
      
        //Looping through all the lines of the table           
        for(int j = 1; j < myTable.length; j++){
          
          String[] myRow = split(myTable[j], '\t'); //Object that holds each line
          float tonnage = parseFloat(myRow[i]);     //Getting the tonnage for each column
          
          println("i: " + i + ", j: " + j + ", tonnage: " + tonnage);
        }
      }
    
    }
    
    
    //This function is going to return the highest value in a given column in a table
    float getHighestValue(String[] anyTable, int columnIndex ){  
      float highestValue = 0;
      for(int i = 0; i < anyTable.length; i++){
        String[] myRow = split(anyTable[i], '\t');
        float columnValue = parseFloat(myRow[columnIndex]); 
        if(columnValue > highestValue){
          highestValue = columnValue;
        } 
      }
      return highestValue;  
    }
    
    

    code

    tweaks (0)

    license

    advertisement

    Gabriel Gianordoli

    DSNY: Collection Tonnages, Manhattan - Initial Sketch

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    Garbage collection tonnages in Manhattan, 2012-2013, in tons per day.
    Source: http://www.nyc.gov/html/nycwasteless/html/resources/reports_ll40.shtml

    This sketch was the final result of a Processing workshop I taught at the NYC Open Data Meetup: http://www.meetup.com/NYC-Open-Data/events/141139252/

    Check out the final sketch here: http://www.openprocessing.org/sketch/122501

    And all revisions in between: http://studio.sketchpad.cc/sp/pad/view/ro.9DwgaMeSeCj7m/latest

    You need to login/register to comment.