1

question is straight forward, how do I transform all the continuous variables in a data.table into quantiles of those variables.

so for example

a   b  c  id
1   4  6  123
43  2  34 124

Should look like

a   b   c   id
q1  q2  q1  123
q2  q1  q2  124
econfin
  • 53
  • 5
  • You can check out this Q&A; my answer is a bit more specific to `data.table`: https://stackoverflow.com/a/28423596/3576984 – MichaelChirico Apr 16 '22 at 07:31
  • As for the "all variables" part -- that's `lapply(.SD, f)` where `f` is the function to apply the transformation in the above question. Lastly, for "all continuous variables", you can try using `.SDcols = is.numeric` or `.SDcols = is.double` to filter for (integer or double) or (double), respectively. – MichaelChirico Apr 16 '22 at 07:32
  • What exactly are you expecting for values in place of your `q1` and `q2` for each column? Especially with just two values in each column, it seems not perfectly clear what you're hoping to achieve. – r2evans Apr 16 '22 at 21:11

0 Answers0