[R] exporting a split list

Alexy Khrabrov deliverable at gmail.com
Tue Nov 27 12:41:05 CET 2007


Using wk <- with(d, split(word, kind)), I get the following class table:

wk$`1`
[1] "a" "bra" ...  # (*)

wk$`10`
"ca" "dabra" ...

Now I need to export it in the following format:

class    num_members   examples
1          23                       a bra ...
10        4                         ca dabra

For each class C such as `1`, I need to print the number of members,  
length(wk[[C]]), and show N examples as sample(wk[[C]], N), space- 
separated.  The columns themselves are tab-separated.

What's the R way to export such as list?
Cheers,
Alexy



More information about the R-help mailing list