title: Removing duplicates of same date and location (3 columns) in R
body: <p>I know there are like a million questions regarding duplicate removal, but unfortunately
  none of them helped me so far. I struggle with the following:</p>
  <p>I have a data frame (loc) that includes data of citizen science observations of nature (animals, plants, etc.). It has about 90.000 rows and looks like this:</p>
  <pre><code>      ID      Datum      lat     long      Anzahl        Art         Gruppe    Anrede Wochentag
  1 1665376475 2019-05-09 51.30993 9.319896     20 Alytes obstetricans Amphibien   Herr        Do
  2  529728479 2019-05-06 50.58524 8.503332      1 Alytes obstetricans Amphibien   Frau        Mo
  3 1579862637 2019-05-23 50.53925 8.467546      8 Alytes obstetricans Amphibien   Herr        Do
  4 -415013306 2019-05-06 50.58524 8.503332      3 Alytes obstetricans Amphibien   Frau        Mo
  </code></pre>
  <p>I also made a small sample data frame (loc_sample) of 10 observations and used dput(loc_sample):</p>
  <pre><code>  structure(list(ID = c(688380991L, -1207894879L, 802295973L, -815104336L, -632066829L, -133354744L, 1929856503L, 952982037L, 1782222413L, 1967897802L), 
    Datum = structure(c(1559088000, 1558742400, 1557619200, 1557273600, 1557187200, 1557619200, 1557619200, 1557187200, 1557964800, 1556841600), 
    tzone = &quot;UTC&quot;, 
    class = c(&quot;POSIXct&quot;, &quot;POSIXt&quot;)), 
    lat = c(52.1236088700115, 51.5928822313012, 53.723426877949, 50.7737623304861, 49.9238597947287, 51.805563222817, 50.1738326622472, 51.2763067511127, 51.395189306337, 51.5732959108075), 
    long = c(8.62399927116144, 9.89597797393799, 9.04058595819038, 8.20740532922287, 8.29073164862348, 9.9225640296936, 8.79065646492143, 6.40700340270996, 6.47360801696777, 6.25690012620748), 
    Anzahl = c(2L, 25L, 4L, 1L, 1L, 30L, 2L, 1L, 1L, 1L), 
    Art = c(&quot;Sturnus vulgaris&quot;, &quot;Olethreutes arcuella&quot;, &quot;Sylvia atricapilla&quot;, &quot;Buteo buteo&quot;, &quot;Turdus merula&quot;, &quot;Orchis mascula subsp. mascula&quot;, &quot;Parus major&quot;, &quot;Luscinia megarhynchos&quot;, &quot;Milvus migrans&quot;, &quot;Andrena bicolor&quot;), 
   Gruppe = c(&quot;Voegel&quot;, &quot;Schmetterlinge&quot;, &quot;Voegel&quot;, &quot;Voegel&quot;, &quot;Voegel&quot;, &quot;Pflanzen&quot;, &quot;Voegel&quot;, &quot;Voegel&quot;, &quot;Voegel&quot;, &quot;InsektenSonstige&quot;), 
   Anrede = c(&quot;Herr&quot;, &quot;Herr&quot;, &quot;Frau&quot;, &quot;Herr&quot;, &quot;Herr&quot;, &quot;Herr&quot;, &quot;Herr&quot;, &quot;Herr&quot;, &quot;Herr&quot;, &quot;Herr&quot;), 
   Wochentag = structure(c(4L, 7L, 1L, 4L, 3L, 1L, 1L, 3L, 5L, 6L), 
   .Label = c(&quot;So&quot;, &quot;Mo&quot;, &quot;Di&quot;, &quot;Mi&quot;, &quot;Do&quot;, &quot;Fr&quot;, &quot;Sa&quot;), 
   class = c(&quot;ordered&quot;, &quot;factor&quot;))), 
   row.names = c(NA, -10L), 
   class = &quot;data.frame&quot;)
  </code></pre>
  <p>For my question only the variables <code>Datum</code>, <code>lat</code>and <code>long</code> are important. Datum is a date and in the POSIXct format while lat and long are both numeric. There are quite a few observations that were reported on the same day from the exact same location. I would like to filter and remove those. So I have to check three separate columns and keep only one of each &quot;same-place-same-day&quot; observations.</p>
  <p>I already tried putting the three variables in question into one:</p>
  <pre><code>  loc$dupl &lt;- paste(loc$Datum, loc$lat, loc$long, sep=&quot; ,&quot;)
    locu &lt;- unique(loc[,2:4])
  </code></pre>
  <p>It seems like I managed to filter the duplicates, but I'm actually not sure, if that's how it is done correctly.</p>
  <p>Also, that gives me a data frame with only <code>Datum</code>, <code>lat</code> and <code>long</code>. As a final result I need the original data frame without the duplicates in date and location, but with all the other information for the unique rows still left.
  When I try:</p>
  <pre><code> locu &lt;- unique(loc[,2:9])
  </code></pre>
  <p>It gives me all the other columns, but it doesn't remove the date and location duplicates.</p>
  <p>Thanks in advance for your help!</p>