Smart recoding of vector values [🇷 for BE/BA]
Hi all, especially the R experts out there,
I have a vector like
and I would like to rename/reorder/resomething this vector so that
They are actually factor levels.
So far I took a look at
Anyone able to tell how?
Thanks a lot in advance and have a great day.
I have a vector like
a=c(1,1,2,2,3,5,5,6,6,7,8,8,9,9)
and I would like to rename/reorder/resomething this vector so that
a=c(1,1,2,2,3,4,4,5,5,6,7,7,8,8)
They are actually factor levels.
So far I took a look at
reorder
, rank
, and sort
and googled around but I am not really getting anywhere. I have written a clumsy function that does the trick, but I am sure this can be achieved with a one-liner somehow.Anyone able to tell how?
Thanks a lot in advance and have a great day.

—
Pass or fail!
ElMaestro
Pass or fail!
ElMaestro
Complete thread:
- Smart recoding of vector valuesElMaestro 2016-09-21 12:59
- Vectorized if d_labes 2016-09-21 13:32
- Smart recoding of vector values mittyri 2016-09-21 13:34
- Smart recoding of vector values ElMaestro 2016-09-21 14:02
- Smart recoding of vector values d_labes 2016-09-21 15:27