Message-ID: <43991AC1.10003@cirad.fr>
Date: 2005-12-09T05:48:49Z
From: Jacques VESLOT
Subject: complex table
In-Reply-To: <C9328F0EEDC3BC439FDABD12060E910902233C@erini1.ERINI.local>
it is not perfectly clear for me, but you could try :
DF[,1:72] <- as.data.frame(lapply(DF[,1:72], factor, levels=1:6))
lapply(split(DF, DF$cluster), function(x) apply(x[,-73], 2, table))
lapply(split(DF, DF$cluster), function(x) { x11() ;
barplot(apply(x[,-73], 2, table)) })
lapply(split(DF, DF$cluster), function(x) { x11() ;
barplot(apply(x[,-73], 2, table), beside=T) })
Michael Anyadike-Danes a Âécrit :
>I have a data table with 712 cases (rows) describing young people’s activities for 72 months each case has been classified into one
>of 5 clusters.
>
>The first 72 columns are monthly activities coded 1 to 6 (e.g. school =1) and the 73rd column is the cluster number of the case.
>
>I wish to summarise the distribution of monthly activities by cluster e.g for cluster 1: 6 months school; 24 further education; etc.
>
>After looking through available resources my solution is quite complex involving – amongst other things a series of loops.
>
>I’m sure there is a quicker and simpler way (manipulating table or xtabs) but I just can’t see how to do it.
>
>Any advice?
>
>Michael Anyadike-Danes
>
> [[alternative HTML version deleted]]
>
>
>
>------------------------------------------------------------------------
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>