[R] correlation between XY coordinates

Joshua Wiley jwiley.psych at gmail.com
Sun May 6 05:44:44 CEST 2012


Hi Chris,

As Jeff mentioned, it is hard to tell what you want (correlations
between sets of coordinates could mean many things it seems like to
me), but here is something that perhaps helps:

## some data (usually nice if you provide this rather than us having
to make something up)
d1 <- cbind(x <- rnorm(100), y <- rnorm(100))
d2 <- cbind(x2 = x + rnorm(100), y2 = y + rnorm(100))

## canonical correlation of the two matrices
cancor(d1, d2)

## simple correlation matrix of each dataset
cor(d1)
cor(d2)

Cheers,

Josh

On Sat, May 5, 2012 at 5:32 PM, Christopher Kurby <kurbyc at gvsu.edu> wrote:
> Hello r world,
>
> Does anyone know a function or package that can compute correlations between sets of XY coordinates?
>
> Thanks in advance for your help,
> Chris
>
> ______________________________________________
> R-help at 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.



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/



More information about the R-help mailing list