I wrote these commands[1] just for my own use, so they're a bit rough
around the edges, but I've found them really useful for dealing with
tabular data embedded in webpages.

sort-by sorts a table by the selected column (using some heuristics to
determine if the column is numeric of alphabetic).  Just select a
value or put the cursor in the column you want to sort by and activate
the command.

add-column adds a new column to the table containing the cursor/
selection.  You can refer to the (floating-point) values of each
column using variables such as $1, $2, $3, etc.  You can write any
javascript expression.

Try it out on this[2] page; click in the table, execute "add-column
($1-$3)/$1" to compute the proportion of minority (i.e., non-white)
residents in each county, then select a value in the new column and
execute "sort-by."  You can immediately see that only four counties in
New York have above-average minority populations (the average is 32%),
and that 70% of Bronx residents are not white (the most of any New
York county).  Note that the sort is ascending (not configurable at
the moment).

If the values added by add-column are too ugly for you, try "add-
column Math.round(($1-$3)/$1*100)+'%'".  This is really intended for
one-off analysis, though, so it's unlikely that you'd put that much
effort into each command.

The interaction with the commands is a little clumsy at the moment, so
if you have an idea for specifying the table to add to/sort feel free
to comment.

[1] http://gist.github.com/98344
[2]
http://factfinder.census.gov/servlet/GCTTable?_bm=n&_lang=en&mt_name=DEC_2000_PL_U_GCTPL_ST2&format=ST-2&_box_head_nbr=GCT-PL&ds_name=DEC_2000_PL_U&geo_id=04000US36
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to