Hi

Assuming the same order in both tables divide only columns you wont 
and then add column of names. You need to work with data frame, as 
working with matrices cannot use mixed types columns.

tab1<-data.frame(letters[1:3], 1:3)
tab2<-data.frame(letters[1:3], 10)
data.frame(tab1[,1],tab1[,-1]/tab2[,-1])
  tab1...1. tab1....1..tab2....1.
1         a                   0.1
2         b                   0.2
3         c                   0.3

How to set appropriate column names you can find in help page 
?data.frame
 
HTH
Petr


On 27 Oct 2006 at 18:42, Serguei Kaniovski wrote:

Date sent:              Fri, 27 Oct 2006 18:42:36 +0200 (CEST)
From:                   Serguei Kaniovski <[EMAIL PROTECTED]>
To:                     r-help@stat.math.ethz.ch
Organization:           WIFO
Subject:                [R] How to best divide table by table

> Hi all,
> 
> how can I divide two tables of the same dimension so that all names
> are preserved, ie do not become NA? I have "tab1" and "tab2", each
> having names in the first column. I want "tab3" with the same names
> and values "tab1/tab2".
> 
> Thanks,
> Serguei
> 
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented,
> minimal, self-contained, reproducible code.

Petr Pikal
[EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to