Bioequivalence and Bioavailability Forum

Main page Policy/Terms of Use Abbreviations Latest Posts

 Log-in |  Register |  Search

Back to the forum  Query: 2018-05-28 01:24 CEST (UTC+2h)
 

Smart recoding of vector values [R for BE/BA]

posted by ElMaestro - Denmark, 2016-09-21 12:59  - Posting: # 16657
Views: 2,943

Hi all, especially the R experts out there,

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.:-)

“A ten-year, double-blind study from the Mayo Clinic concluded that even in late stages of dementia, the last to go is the lobe of the brain in charge of cafeteria layout.” (Serge Storms/Tim Dorsey).


Best regards,
ElMaestro

- Bootstrapping is a relatively new hobby of mine. I am only 30 years late to the party.

Complete thread:

Back to the forum Activity
 Mix view
Bioequivalence and Bioavailability Forum |  Admin contact
18,295 posts in 3,890 threads, 1,165 registered users;
7 users online (0 registered, 7 guests).

To know that we know what we know,
and to know that we do not know what we do not know,
that is true knowledge.    Nicolaus Copernicus

The BIOEQUIVALENCE / BIOAVAILABILITY FORUM is hosted by
BEBAC Ing. Helmut Schütz
XHTML/CSS RSS Feed