Converting an ftable (contingency table) to a dataframe in R?

Ftable > r r Survived No Yes Class Sex Age 1st Male Child 0 5 Adult 118 57 ... snip ... Female Child 0 0 Adult 3 20 > > # long format > as.data. Frame(r) Class Sex Age Survived Freq 1 1st Male Child No 0 2 2nd Male Child No 0 3 3rd Male Child No 35 ... snip ... 30 2nd Female Adult Yes 80 31 3rd Female Adult Yes 76 32 Crew Female Adult Yes 20 > > # wide format, but do not care the col name > data. Frame(expand.

Grid(rev(attr(r, "row. Vars"))), unclass(r)) Age Sex Class X1 X2 1 Child Male 1st 0 5 2 Adult Male 1st 118 57 3 Child Female 1st 0 1 ... snip ... 14 Adult Male Crew 670 192 15 Child Female Crew 0 0 16 Adult Female Crew 3 20 > > # using reshape2 library > library(reshape2) > dcast(as.data. Frame(r), as.

Formula(paste(paste(names(attr(r, "row. Vars")), collapse="+"), "~", paste(names(attr(r, "col. Vars")))))) Using Freq as value column: use value_var to override.

Class Sex Age No Yes 1 1st Male Child 0 5 2 1st Male Adult 118 57 3 1st Female Child 0 1 ... snip ... 14 Crew Male Adult 670 192 15 Crew Female Child 0 0 16 Crew Female Adult 3 20.

1 +1 Thank you for the expand. Grid tip – Andrie Jun 24 at 8:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions