title: Function in R - Transforming A Yes/No variable in a 1/0 variable
body: <p>I need to set a function that help me in restore the Yes/No variable in 0/1 one.</p>
  
  <p>A function should be</p>
  
  <pre><code>x&lt;-function(DataFrame,VariableName,Yes,No){
     .....
    }
  </code></pre>
  
  <p>I set up this code but run only out the function because R do not read the variable setted in () after the dollar sign.</p>
  
  <pre><code>dummy&lt;-function(DB,varr){
          BD$varr &lt;- as.character(DB$varr)
          DB[BD$varr=="Yes"]&lt;-"1"
          DB[BD$varr=="No"]&lt;-"0"
  }
  </code></pre>