0

I have a data table consisting of multiple columns. Column 1:3 are integer64, columns 4:8 are numeric. I want to scale the integer64 columns (which contain both ingeter64 values and NAs) between 0 and 5, leaving NAs as NAs.

The min value of integer64 columns is 1e+5, while the max is 1e+20.

Is there a way to do this?

pisistrato
  • 375
  • 2
  • 14
  • Could you give an example? For normal numbers, of course `(x-min(x))/diff(range(x))*5` works. See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/28481250#28481250 re making a good example. – Frank May 19 '17 at 14:52
  • 1
    I have just realized this was a stupid question. Regardeless of the type of data input (numeric or integer64), what I will get from the rescaling is anyway a numeric value. The solution was very easy, I just divided the orinignal value by 1e+10, this return numeric values, which can be then rescaled between 0 and 5 either using Frank suggestion or scale as in here https://stackoverflow.com/questions/5468280/scale-a-series-between-two-points – pisistrato May 22 '17 at 12:18

0 Answers0