15, 34, 52, 99 をそれぞれ 3, 5, 9, 15 に変換する
> x = integer(100)
> x[15] = 3
> x[34] = 5
> x[52] = 9
> x[99] = 15
> x[c(34, 52, 99, 15, 34, 99)]
[1] 5 9 15 3 5 15
15, 34, 52, 99 をそれぞれ 3, 5, 9, 15 に変換する
> x = integer(100)
> x[15] = 3
> x[34] = 5
> x[52] = 9
> x[99] = 15
> x[c(34, 52, 99, 15, 34, 99)]
[1] 5 9 15 3 5 15
1 を 11,2 を 13,3 を 15,4 を 50 に変換するには
> tbl = c(11, 13, 15, 50)
> (a = tbl[c(1, 2, 3, 1, 1, 2, 3, 4, 2)])
[1] 11 13 15 11 11 13 15 50 13