[R] Vector elements and ratios

David Hugh-Jones davidhughjones at gmail.com
Fri May 26 12:10:37 CEST 2006


> outer(c(20,40,20,60), c(5,4,2), "/")
     [,1] [,2] [,3]
[1,]    4    5   10
[2,]    8   10   20
[3,]    4    5   10
[4,]   12   15   30


cheers
D

On 26/05/06, Andrej Kastrin <andrej.kastrin at siol.net> wrote:
> Dear useRs,
>
> I have two different length vectors: one column (1...m) and one row
> vector (1...n):
>
> 20
> 40
> 20
> 60
>
> 5 4 2
>
> Now I have to calculate ratios between column vector elements and each
> row vector elements:
>
> 4 5 10
> 8 10 20
> 4 5 20
> 15 12 30
>
> Thank's in advance for any suggestions,
>
> Andrej
>
> ______________________________________________
> R-help at 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
>



More information about the R-help mailing list