Dear list,
I have a contingency table :
a - letters[1:3]
t - table(a)
I'm looking for a way to transform this table into data frame, as follows :
Freq
a1
b1
c1
I used :
df - as.data.frame(t, row.names = names(t))
But, this function do not remove the duplicated column. Do you
Hi,
I don't really understand what the problem is... There is no duplicated
column... Maybe you mean the row names? If it is so, then just don't use
row names.
Ivan
Le 3/17/2010 10:45, Carlos Petti a écrit :
Dear list,
I have a contingency table :
a- letters[1:3]
t- table(a)
I'm looking
Dear list,
Sorry, I did not explain myself very well.
I want to obtain a data.frame like this :
Freq
a1
b1
c1
This data.frame contains just one column (Freq) and each row is named.
But when I use this code :
df - as.data.frame(t)
or this code :
df - as.data.frame(t,
Hi
and did you try my suggestion?
as.data.frame(as.matrix(t, row.names = names(t)))
Regards
Petr
r-help-boun...@r-project.org napsal dne 17.03.2010 11:16:43:
Dear list,
Sorry, I did not explain myself very well.
I want to obtain a data.frame like this :
Freq
a1
b1
c1
Hi Carlos,
try
as.data.frame.table(t)
hth.
Carlos Petti schrieb:
Dear list,
I have a contingency table :
a - letters[1:3]
t - table(a)
I'm looking for a way to transform this table into data frame, as follows :
Freq
a1
b1
c1
I used :
df - as.data.frame(t, row.names =
I would then just change it using names()
For example:
names(df) - c(letter, Freq)
df
letter Freq
a a1
b b1
c c1
If you prefer having nothing, I don't really know how to do it because I
couldn't use my dataframes without column names!
HTH
Ivan
Le 3/17/2010
Now I get it, I was still thinking you wanted two columns. I was
confused by the print example.
Petr's suggestion works well then
Ivan
Le 3/17/2010 11:27, Petr PIKAL a écrit :
Hi
and did you try my suggestion?
as.data.frame(as.matrix(t, row.names = names(t)))
Regards
Petr
Dear list,
Thank you for your answers.
Petr, your solution works great :-)
Peter's solution too.
Carlos
2010/3/17 Ivan Calandra ivan.calan...@uni-hamburg.de
Now I get it, I was still thinking you wanted two columns. I was confused
by the print example.
Petr's suggestion works well then
8 matches
Mail list logo