> I have two vectors of different lengths which contain the same set of
> values:
>
> X < -c(2,6,1,7,4,3,5)
> Y <- c(1,1,6,4,6,1,4,1,2,3,6,6,1,2,4,4,5,4,1,7,6,6,4,4,7,1,2)
>
> How can I replace the values in Y with the index (!) of the
corresponding
> values in X. So 2 appears in X in the first coordinate, so all 2รข??s in
Y
> should be replaced by 1, etc.
Really easy this one:
X[Y]
Regards,
Richie.
Mathematical Sciences Unit
HSL
------------------------------------------------------------------------
ATTENTION:
This message contains privileged and confidential inform...{{dropped:21}}
______________________________________________
[email protected] 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.