F,a=174:213,b=214:253)
Thanks very much both of you!
Rob
-Original Message-
From: R. Michael Weylandt
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?
??
>
> -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:
>
>
> ## de
ecked str() and the columns are all numeric
???
-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
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 <- matrix(rno
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)] an
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!)
6 matches
Mail list logo