Smart recoding of vector values [🇷 for BE/BA]
Dear Mittyri and d_labes,
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
❝ 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")
—
Pass or fail!
ElMaestro
Pass or fail!
ElMaestro
Complete thread:
- Smart recoding of vector values ElMaestro 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 valuesElMaestro 2016-09-21 14:02
- Smart recoding of vector values d_labes 2016-09-21 15:27