Hello fellow R-users,
I’ve been mulling this problem over for some time now and have decided it is 
something I have to deal with but can’t, so here goes:
I have a dataset (called maindata, it is 271 columns *13890 rows so I wont post 
the entire thing here, I’ll just explain the situation!) 


I am trying to calculate inter-environment correlation (rF = cov A,B / 
sq.root(varA * varB ) for each row of the dataset. the values needed are (in 80 
of the columns 2*40) in columns 174-213, and 214-253 respectively which 
represent two environments (A or B).

Each of those columns is labelled with Xnumber.A/B        
  e.g. X208.A is column 174 (which also relates to the first column in the B 
environment groups, col.214, X208.B)

effectively the equation is:
  rF=    cov (columns[174:213] , [214:253]) / sqrt( (var[174:213]) * 
(var[214:253]) )

I want each of the 13890 rows to then have the rF value at the end of it (which 
will then be used later against other variables)


Can anyone help me with this problem? I’ve tried allsorts and I have run out 
of ideas.
Thanks in advance,
Rob
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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