# [R] List to a summary table

Wed Jan 5 01:26:42 CET 2011

```Hi

Suppose you have the code below. The result I get from the cat function is
from the avgs object. Now, I have 30 diferent objects like this and I wish
to make a summary table, something like:

Avgs1                                           Avgs2
Avgs3

i= 2 average= 0.515983i           i= 2 average= 0.746983           i= 2
average= 0.2665983
i= 3 average= 0.5135953          i= 3 average= 0.7345953         i= 3
average= 0.23455953
i= 4 average= 0.4998128          i= 4 average= 0.7233128         i= 4
average= 0.21398128

> library(cluster)
> d<-hclust(dist(iris[,-5]))
>
> avgs<-sapply(1:20,function(x)
+ summary(silhouette(cutree(d,x),
+ dist(iris[,-5]))))
> # str(avgs)
>

> # print out the average widths
> for (i in 2:length(avgs)){  # ignore first item
+     cat('i=', i, 'average=', avgs[[i]]\$avg.width, '\n')
+ }
i= 2 average= 0.515983
i= 3 average= 0.5135953
i= 4 average= 0.4998128
i= 5 average= 0.346174
i= 6 average= 0.3382031
i= 7 average= 0.3297649
i= 8 average= 0.324025
i= 9 average= 0.3191681
i= 10 average= 0.3028503
i= 11 average= 0.3072648
i= 12 average= 0.2834498
i= 13 average= 0.2776717
i= 14 average= 0.2855396
i= 15 average= 0.2745142
i= 16 average= 0.2578903
i= 17 average= 0.2531909
i= 18 average= 0.2473504
i= 19 average= 0.2484205
i= 20 average= 0.2545357

thanks
A.Dias
--
View this message in context: http://r.789695.n4.nabble.com/List-to-a-summary-table-tp3174698p3174698.html
Sent from the R help mailing list archive at Nabble.com.

```