| To: | s-news@lists.biostat.wustl.edu |
|---|---|
| Subject: | creating a table composed of smaller tables |
| From: | "Walter R. Paczkowski" <dataanalytics@earthlink.net> |
| Date: | Sun, 14 Jan 2007 15:48:06 -0500 |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=cYzRVNMTuShkw6FWlRaM7LblpaT7LdFBsh7IsQdnvtqisMKWUBhnGA4lCZnljvuW; h=Received:X-Mailer:Date:To:From:Subject:Mime-Version:Content-Type:Message-ID:X-ELNK-Trace:X-Originating-IP; |
Hi,I'm looking for a simple way to create a table that is actually the cbind of two (or more) smaller tables. Suppose I have a table of willingness to buy X gender that looks like
1 2
1 59 53
2 53 59
where the columns are the gender (1 = Male) and the rows are
willingness to buy (1 = Yes). Consider another table of willingness
to buy X income that looks like
1 2 3 4
1 31 28 24 29
2 25 28 32 27
I want
1 2 1 2 3 4
1 59 53 31 28 24 29
2 53 59 25 28 32 27
I can get partway there with a simple function
lapply(lapply(list(x$gender, x$income), table, x$buy), t)
which results in a list with the two small tables from above. How do
I get the single combined table I want without using a for-loop and
the repeated application of cbind? It seems there should be an easy way.
Any suggestions? Thanks, Walt Paczkowski |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Display a GUI dialog to get a filenam, Steffen Barembruch |
|---|---|
| Next by Date: | Re: Display a GUI dialog to get a filenam, Michael Camilleri |
| Previous by Thread: | Display a GUI dialog to get a filenam, Steffen Barembruch |
| Next by Thread: | factor levels, yiwu ye |
| Indexes: | [Date] [Thread] [Top] [All Lists] |