I have years between 1980 to 2000 where each year has repetitive id's. So I'm trying to calculate a correlation coefficient of one variable between id1 and id2 through the years. So I try the following code;
\ddply(df, .(id), summarise, "corr" = cor(x1, x2 = "spearman"))\
However what I would like to calculate is similar to following;
\ddply(df, .(id), summarise, "corr" = cor(x1|id1, x1|id2 = "spearman"))\
So, I can have between-id correlations of x1?