#handy if you like ggplot2 as this is required
#I think this is what you want
library(reshape)
m <- matrix(1:20, nrow=4, dimnames=list(LETTERS[1:4], letters[1:5]))
melt(m)
On Tue, Nov 25, 2008 at 8:01 AM, Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:
> Try this:
>
>> as.data.frame.table(m)
> Var
Try this:
> as.data.frame.table(m)
Var1 Var2 Freq
1 Aa1
2 Ba2
3 Ca3
4 Da4
5 Ab5
6 Bb6
7 Cb7
8 Db8
9 Ac9
10Bc 10
11Cc 11
12Dc 12
13Ad 13
14B
I forgot the reshape equivalent for converting from wide to long format. Can
someone help as my matrix is very big. The followin is just an example.
> m <- matrix(1:20, nrow=4, dimnames=list(LETTERS[1:4], letters[1:5]))
> m
a b c d e
A 1 5 9 13 17
B 2 6 10 14 18
C 3 7 11 15 19
D 4 8 12
3 matches
Mail list logo