Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.64.0809101613220.10089@parser.ilovebacon.org>
Date: 2008-09-10T23:21:16Z
From: Adam D. I. Kramer
Subject: request: most repeated component of a list
In-Reply-To: <799069.796.qm@web32203.mail.mud.yahoo.com>

You might try

apply(t(sapply(l,apply,2,sum)),2,sum)

--Adam

On Wed, 10 Sep 2008, Muhammad Azam wrote:

> Dear R community

> I have stored the results of arrays in a list consist of J-components (say
> 200 components). Each component containing same no of columns but may be
> different no of rows. e.g

> [[1]]
>     [,1] [,2] [,3] [,4] [,5]
> [1,]    4    0    0    0    0
> [2,]    4    3    4    0    0
> [3,]    4    3    4    0    0
> [4,]    4    3    0    0    0
>
> [[2]]
>     [,1] [,2] [,3] [,4] [,5]
> [1,]    4    0    0    0    0
> [2,]    4    4    3    0    0
> [3,]    4    4    3    0    0
> [4,]    4    4    0    0    0
> [5,]    4    4    0    0    0
>
> [[3]]
>     [,1] [,2] [,3] [,4] [,5]
> [1,]    4    0    0    0    0
> [2,]    4    4    1    0    0
> [3,]    4    4    1    0    0
> [4,]    4    4    0    0    0
>
> For 200 components i want to make a frequency table. How can i make a
> frequency table of these components or the most repeated component out of
> all? Any help in this regard will be appreciated.
>
>
> Muhammad Azam
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>