Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-29 Thread Peter Ehlers
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 <-

Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-29 Thread S Ellison
> 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

Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-28 Thread arun
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 

Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-28 Thread David Winsemius
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

Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-28 Thread R. Michael Weylandt
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

[R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-28 Thread Yi
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