Re: [R] correlations between columns for each row

2011-11-15 Thread robgriffin247
Just as an update on this problem: I have managed to get the variance for the selected columns Now all I need is the covariance between these 2 selections - the two target columns are and the aim is that a new column contain a covariance value between these on each row: maindata[,c(174:213)]

Re: [R] correlations between columns for each row

2011-11-15 Thread Joshua Wiley
Hi Rob, Here is one approach: ## define a function that does the calculations ## (the covariance of two vectors divided by the square root of ## the products of their variances is just a correlation) rF - function(x, a, b) cor(x[a], x[b], use = complete.obs) set.seed(1) bigdata -

Re: [R] correlations between columns for each row

2011-11-15 Thread Rob Griffin
??? -Original Message- From: Joshua Wiley Sent: Tuesday, November 15, 2011 7:14 PM To: robgriffin247 Cc: r-help@r-project.org Subject: Re: [R] correlations between columns for each row Hi Rob, Here is one approach: ## define a function that does the calculations ## (the covariance

Re: [R] correlations between columns for each row

2011-11-15 Thread R. Michael Weylandt michael.weyla...@gmail.com
: Tuesday, November 15, 2011 7:14 PM To: robgriffin247 Cc: r-help@r-project.org Subject: Re: [R] correlations between columns for each row Hi Rob, Here is one approach: ## define a function that does the calculations ## (the covariance of two vectors divided by the square root

Re: [R] correlations between columns for each row

2011-11-15 Thread Rob Griffin
very much both of you! Rob -Original Message- From: R. Michael Weylandt michael.weyla...@gmail.com Sent: Tuesday, November 15, 2011 9:28 PM To: Rob Griffin Cc: Joshua Wiley ; r-help@r-project.org Subject: Re: [R] correlations between columns for each row Is the whole thing a data frame

[R] correlations between columns for each row

2011-11-14 Thread Rob Griffin
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!)