Hello All,

I have a panel date - here a small-scale example:

df <- data.frame(cbind(rep(c("AUT","BEL","DEN","GER"),4),cbind(rep(c(1999,2000,2001,2002),4)),sample(10,16,replace=T)))
names(df) <- c("country","year","x")

SORT <- c("GER","BEL","DEN","AUT")

I need to compute the correlation between countries in the variable "x" in such a way that the rows & columns of the resulting correlation matrix are not in an alphabetical order but in the order of a given factor vector - here SORT.

How can I do this? Greatly appreciate any help!

Serguei Kaniovski

______________________________________________
R-help@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.

Reply via email to