[R] loop problem

From: Frank Johannes <fjohannes_at_fastmail.fm>
Date: Tue 06 Dec 2005 - 02:28:23 EST

Here is my problem. Say I have two matrices,

Matrix A:

a b c
4 5 2
3 2 1
4 5 6

Matrix B:
d e f g h
3 4 5 2 1
2 3 7 8 6
8 5 1 3 4

I would like to correlate vector a of matrix A with with vectors d,e,f,g,h of
matrix "B" and save the p-values (or some type of statistic) in a seperate result vector, say z. Then, I would like to repeat this process for vector b and vector c of matrix A. In the present example, vector z would end up containg 15 elements.
I tried a few double loops, but was not successful in saving the results in a vector. I was only able to print them with the "print" or "cat" command, but could not turn the print or cat results into an accessible object.

Help would be appreciated.
Thank you,


                          or over the web

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Dec 06 02:49:01 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:28 EST