title: Separate data frame depending on one column duplicates
body: <p>I have a large data frame with a lot of rows and columns. In one column there are characters, some of them occur only once, other multiple times. I would now like to separate the whole data frame, so that I end up with two data frames, one with all the rows that have characters that repeat themselves in this one column and another one with all the rows with the charcaters that occur only once. Like for example:</p>
  
  <pre><code>One = c(1,2,3,4,5,6,7,8,9,10)
  Two = c(4,5,3,6,2,7,1,8,1,9)
  Three = c("a", "b", "c", "d","d","e","f","e","g","c")
  df &lt;- data.frame(One, Two, Three)
  
  &gt; df
      One Two Three
  1    1   4     a
  2    2   5     b
  3    3   3     c
  4    4   6     d
  5    5   2     d
  6    6   7     e
  7    7   1     f
  8    8   8     e
  9    9   1     g
  10  10   9     c
  </code></pre>
  
  <p>I wish to have two data frames like</p>
  
  <pre><code>&gt; dfSingle
      One Two Three
  1    1   4     a
  2    2   5     b
  7    7   1     f
  9    9   1     g
  
  &gt; dfMultiple
      One Two Three
  3    3   3     c
  4    4   6     d
  5    5   2     d
  6    6   7     e
  8    8   8     e
  10  10   9     c
  </code></pre>
  
  <p>I tried with the <code>duplicated()</code> function</p>
  
  <pre><code>dfSingle = subset(df, !duplicated(df$Three))
  dfMultiple = subset(df, duplicated(df$Three))
  </code></pre>
  
  <p>but it does not work as the first of the "c", "d" and "e" go to the "dfSingle".
  I also tried to do a for-loop</p>
  
  <pre><code>MulipleValues = unique(df$Three[c(which(duplicated(df$Three)))])
  dfSingle = data.frame()
  x = 1
  dfMultiple = data.frame()
  y = 1
  for (i in 1:length(df$One)) {
    if(df$Three[i] %in% MulipleValues){
      dfMultiple[x,] = df[i,]
      x = x+1
      } else {
      dfSingle[y,] = df[i,]
      y = y+1
    }
  }
  </code></pre>
  
  <p>It seems to do the right thing as the data frames have now the right amont of rows but they somehow have 0 columns. </p>
  
  <pre><code>&gt; dfSingle
  data frame with 0 columns and 4 rows
  &gt; dfMultiple
  data frame with 0 columns and 6 rows
  </code></pre>
  
  <p>What am I doing wrong? Or is there another way to do this?</p>
  
  <p>Thanks for your help!</p>