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

posted by ElMaestro  – Denmark, 2016-09-21 16:02 (3194 d 01:38 ago) – Posting: # 16661
Views: 4,884

Dear Mittyri and d_labes,


❝ my noob version

a <- c(1,1,2,2,3,5,5,6,6,7,8,8,9,9)

a <- as.integer(factor(a, unique(a)))


Thanks a lot to both of you. You guys are nothing short of geniuses.
I think Mityri's example is better. The example that I gave had one single missing integer, but there are frequently plenty, like
a=c(1,1,2,2,3,5,5,6,6,7,8,8,12,12, 13,13,14,16,16) etc. I apologise I should have written that.



a<-5
if(2*a<-<-10) cat("Yah, that '<-' business is very neat.\n")
:-D:-D:-D

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,673 registered users;
37 visitors (0 registered, 37 guests [including 11 identified bots]).
Forum time: 17:40 CEST (Europe/Vienna)

Complex, statistically improbable things are by their nature
more difficult to explain than
simple, statistically probable things.    Richard Dawkins

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5