title: Why won't my data frames merge?
body: <p>Okay, so I'm a pretty decent R-programmer, working in it like 3/5 days a week and for the last week I ran into a rather unique problem. I work in R-studio, where I was unable to merge the datasets described ahead</p>
  
  <p>I have 2 datasets:<br>
  Dataset <strong>df</strong>: 13287320 observations by 20 variables<br>
  Dataset <strong>data1</strong>: 9453 observations by 2 variables</p>
  
  <p>Both <strong>df</strong> and <strong>data1</strong> have a common variable, namely <strong>user</strong></p>
  
  <p><strong>df</strong> has multiple copies of users, so it looks kinda of like:</p>
  
  <pre><code>user  var2  var3  var4  ........  var20
  1a     x     x     x                x
  1a     x     x     x                x
  1a     x     x     x                x
  2a     x     x     x                x
  2a     x     x     x                x
  3a     x     x     x                x
  4a     x     x     x                x
  5a     x     x     x                x
  6a     x     x     x                x
  6a     x     x     x                x
  6a     x     x     x                x
  .      .     .     .                .
  .      .     .     .                .
  .      .     .     .                .
  etc.
  </code></pre>
  
  <p>Where <strong>data1</strong> looks neater:</p>
  
  <pre><code>user  date
  1b     .
  2b     .
  3b     .
  4b     .
  5b     .
  6b     .
  .      .
  .      .
  .      .
  etc.
  </code></pre>
  
  <p>Obviously I am well aware that merging generally is done by either <code>merge()</code> or if the package plyr is installed <code>join()</code>.</p>
  
  <p><strong><em>Now for the actual problem:</em></strong></p>
  
  <p>When I try to use:</p>
  
  <pre><code>x &lt;- merge(df, data1, by="user", all=FALSE)
  </code></pre>
  
  <p>The result will be where <code>x</code> has 0 observations by 21 variables</p>
  
  <p>So then I thought, lets try the <code>join()</code> function and used the following code:</p>
  
  <pre><code>library(plyr)
  x &lt;- join(df, data1, by="user", type="inner")
  </code></pre>
  
  <p>Which then resulted in <code>x</code> having 0 observations by 21 variables</p>
  
  <p>I tried countless of variations with different types/alls and leaving out the by part, however all resulted the same.</p>
  
  <p>The idea I then had was to actual test if the users of df are in data1 so I tried a subset with the first user, user 1</p>
  
  <pre><code>x &lt;- subset(df, user == "1b")
  </code></pre>
  
  <p>The result was a subset where <code>x</code> had 3 observations and 20 variables. (1a in the example).</p>
  
  <p>I am kind of at a loss at where to continue next. </p>
  
  <p>An idea I had was to subset the unique users, however I'm not sure how to achieve this</p>
  
  <pre><code>a &lt;- unique(data1$user)
  b &lt;- subset(df, user %in% c(a))
  </code></pre>
  
  <p>The above code doesn't seem to work either so if anyone can help me, it would be greatly appreciated.</p>
  
  <p><strong>Edited the variable name to avoid further confusion</strong>    </p>