[R] ask a question about data replacement

song song
Fri, 29 Jan 2010 07:23:45 -0000

i got it
use function rank can get the result



2010/1/28 song song <rprojecthelp@gmail.com>

> the question like this :
>
>  x=c(2,6,8,11,11,11,6,8,2,8,6,11,8,2,6,11)
>
> x contains values (2, 6, 8, 11) with frequency (3, 4, 4, 5).
>
> now I want to get the vector by replacing  (2, 6, 8, 11) --->>> (1
2 3 4)
>
> that is, want to get new x as (1 2 3 4 4 4 2 3 1 3 2 4 3 1 2 4)
>
>
> is there any function in R do this?
>
> Thank you!!
>

	[[alternative HTML version deleted]]