Search Results

Search found 2 results on 1 pages for 'damonjw'.

Page 1/1 | 1 

  • Using Python for a Wacom tablet on Mac & Linux

    - by DamonJW
    I am shortly going to buy a Wacom Bamboo Pen&Touch, and I'd like to be able to access it from Python, preferably using PyQt. I've found a Python module for accessing it under windows (cgkit/wintab) and I've seen Python code for accessing it using GTK (GnomeTabletApps). Is there an equivalent for Mac? The Cocoa documentation provided by Wacom is way beyond me.

    Read the article

  • Using reshape + cast to aggregate over multiple columns

    - by DamonJW
    In R, I have a data frame with columns for Seat (factor), Party (factor) and Votes (numeric). I want to create a summary data frame with columns for Seat, Winning party, and Vote share. For example, from the data frame df <- data.frame(party=rep(c('Lab','C','LD'),times=4), votes=c(1,12,2,11,3,10,4,9,5,8,6,15), seat=rep(c('A','B','C','D'),each=3)) I want to get the output seat winner voteshare 1 A C 0.8000000 2 B Lab 0.4583333 3 C C 0.5000000 4 D LD 0.5172414 I can figure out how to achieve this. But I'm sure there must be a better way, probably a cunning one-liner using Hadley Wickham's reshape package. Any suggestions? For what it's worth, my solution uses a function from my package djwutils_2.10.zip and is invoked as follows. But there are all sorts of special cases it doesn't deal with, so I'd rather rely on someone else's code. aggregateList(df, by=list(seat=seat), FUN=list(winner=function(x) x$party[which.max(x$votes)], voteshare=function(x) max(x$votes)/sum(x$votes)))

    Read the article

1