1

Is there a function/ way to generate dummy variable in Julia similar to R? I know I can use RCall package and create the dummy variable then use @rget but I'm looking for an alternative in Julia.

x1=string.([2 ,1 ,2,  1, 2 ,1 ,1 ,3, 2, 2])
x2=string.([1 ,1 ,3, 2, 2, 2 ,1 ,2,  1, 2])
R"""
library(qdapTools)
df = data.frame(catg1 = $x1, catg2= $x2)
dum_var=cbind(mtabulate(df$catg1), mtabulate(df$catg2))
"""
Adam
  • 131
  • 6
  • I have closed the question as it seems to me it is exactly the same as https://stackoverflow.com/questions/64565276/julia-dataframes-how-to-do-one-hot-encoding. If there is something else you would need please comment. – Bogumił Kamiński Jan 18 '21 at 09:06

0 Answers0