title: Report the differences between two data frame in R
body: <p>I have two data frames which are loaded from csv files. Basically from different environment but similar format/columns, They can have differences in rows/values. I would like to find the differences and create them in a new data frame. Also both data frame will have same order. I have 100's of files to be compared. Thanks in advance.</p>
  
  <p>Dataframe1: df1test</p>
  
  <pre><code>product | country | partner | value
  ------------------------------------
  prdct1  |  china  | part1   | ["563,45"]
  prdct2  |  UK     | part4   | ["52,455"]
  prdct3  |  USA    | part2   | ["563,45"]
  prdct4  |  ITALY  | part6   | ["674,45"]
  prdct5  |  UK     | part7   | ["563,578"]
  </code></pre>
  
  <p>Dataframe2: df1prod</p>
  
  <pre><code>product | country | partner | value
  ------------------------------------
  prdct1  |  china  | part1   | ["563,45"]
  prdct2  |  UK     | part4   | ["247,455"]
  prdct3  |  USA    | part41  | ["563,45"]
  prdct4  |  UK     | part6   | ["0,45"]
  </code></pre>
  
  <p>I would like to show the differences in third data frame</p>
  
  <p>Dataframe3: dfDifference</p>
  
  <pre><code>Env:test                             Env:prod    
  product| country|partner| value      product| country | partner | value
  ------------------------------------ -----------------------------------
  prdct2 | UK     |part4 | ["52,455"]  prdct2 |UK |part4  | ["247,455"]
  prdct3 | USA    |part2 | ["563,45"]  prdct3 |USA|part41 | ["563,45"]
  prdct4 | ITALY  |part6 | ["674,45"]  prdct4 |UK |part6  | ["0,45"]
  prdct5 | UK     |part7 | ["563,578"] Not Available
  </code></pre>
  
  <p>I tried the following functions and methods but did'nt workout</p>
  
  <pre><code>Compare function
      comptest&lt;-compare(df1test,df1prod,allowAll = TRUE)
  
  Variable combine
      df1test$Varcomp &lt;- apply(df1test,1,paste,collapse=';')
      df1prod$Varcomp &lt;- apply(df1prod,1,paste,collapse=';')
      aabb&lt;-sapply(df1prod$Varcomp,FUN = function(x){x==df1test$Varcomp})
  </code></pre>