sforming 4x3 data frame into 2 column df in R
I have the following data frame:
> foo
w x y z
n 1.51550092 1.4337572 1.2791624 1.1771230
q 0.09977303 0.8173761 1.6123402 0.1510737
r 1.17083866 1.2469347 0.8712135 0.8488029
What I want to do is to change it in
newdf<-data.frame(k1=rep(row.names(foo),ncol(foo)),stack(foo))
--- On Fri, 1/2/13, Gundala Viswanath wrote:
From: Gundala Viswanath
Subject: [R] Transforming 4x3 data frame into 2 column df in R
To: "r-h...@stat.math.ethz.ch"
Date: Friday, 1 February, 2013, 11:30 AM
I have
Dear Gundala,
Try
as.data.frame.table(foo)
HTH,
Jorge.-
On Fri, Feb 1, 2013 at 5:00 PM, Gundala Viswanath <> wrote:
> I have the following data frame:
>
> > foo
>w x y z
> n 1.51550092 1.4337572 1.2791624 1.1771230
> q 0.09977303 0.8173761 1.6123402 0.15107
I have the following data frame:
> foo
w x y z
n 1.51550092 1.4337572 1.2791624 1.1771230
q 0.09977303 0.8173761 1.6123402 0.1510737
r 1.17083866 1.2469347 0.8712135 0.8488029
What I want to do is to change it into :
> newdf
1 nw 1.51550092
2 q w
4 matches
Mail list logo