On 2012-08-29 08:45, S Ellison wrote:
id price distance
1 2 4
1 35
...
2 4 8
2 5 9
I would like to calculate the rank-order correlation between
price and distance for each id.
cor(price,distance,method = "spearman") calculate a
correlation for all.
Try by()
#Example
d <-
> id price distance
> 1 2 4
> 1 35
> ...
> 2 4 8
> 2 5 9
> I would like to calculate the rank-order correlation between
> price and distance for each id.
>
> cor(price,distance,method = "spearman") calculate a
> correlation for all.
>
Try by()
#Example
d <- data.frame(g=gl
rom: Yi
To: R-help@r-project.org
Cc:
Sent: Tuesday, August 28, 2012 10:01 PM
Subject: [R] Help on calculating spearman rank correlation for a data frame
with conditions
Dear all,
Suppose my data frame is as follows:
id price distance
1 2 4
1 3 5
...
2 4 8
2 5 9
...
n 3 7
n
On Aug 28, 2012, at 9:20 PM, R. Michael Weylandt wrote:
On Tue, Aug 28, 2012 at 9:01 PM, Yi wrote:
Dear all,
Suppose my data frame is as follows:
id price distance
1 2 4
1 35
...
2 4 8
2 5 9
...
n 3 7
n 8 9
I would like to calculate the rank-order correlation betw
On Tue, Aug 28, 2012 at 9:01 PM, Yi wrote:
> Dear all,
>
> Suppose my data frame is as follows:
>
> id price distance
> 1 2 4
> 1 35
> ...
> 2 4 8
> 2 5 9
> ...
> n 3 7
> n 8 9
>
> I would like to calculate the rank-order correlation between price and
> distance for each
Dear all,
Suppose my data frame is as follows:
id price distance
1 2 4
1 35
...
2 4 8
2 5 9
...
n 3 7
n 8 9
I would like to calculate the rank-order correlation between price and
distance for each id.
cor(price,distance,method = "spearman") calculate a correlation for
6 matches
Mail list logo