title: Using RNN in R with factorial input variables
body: <p>In <a href="https://cran.r-project.org/package=rnn" rel="nofollow"><code>rnn</code></a> package in R, the example shows how to train a RNN with numeric input variables.</p>
  
  <p>The example code is:</p>
  
  <pre><code>library('rnn')
  
  # create training numbers
  set.seed(1)
  X1 = sample(0:127, 7000, replace=TRUE)
  X2 = sample(0:127, 7000, replace=TRUE)
  
  # create training response numbers
  Y &lt;- X1 + X2
  
  # convert to binary
  X1 &lt;- int2bin(X1, length=8)
  X2 &lt;- int2bin(X2, length=8)
  Y  &lt;- int2bin(Y,  length=8)
  
  # create 3d array: dim 1: samples; dim 2: time; dim 3: variables
  X &lt;- array( c(X1,X2), dim=c(dim(X1),2) )
  
  # train the model
  model &lt;- trainr(Y=Y,
                  X=X,
                  learningrate   =  0.1,
                  hidden_dim     = 10,
                  start_from_end = TRUE )
  </code></pre>
  
  <p>In the above example, <code>X1</code> and <code>X2</code> are numerical variables.</p>
  
  <p>How can I train a RNN model in R if the input variables are factor?</p>
  
  <p>Thanks a lot,</p>