Ce chapitre est en cours d’écriture.

df <- data.frame(A = rep(1:3, each = 4), B = rep(1:4, 
  each = 3), C = rep(1:2, 6))
df
   A B C
1  1 1 1
2  1 1 2
3  1 1 1
4  1 2 2
5  2 2 1
6  2 2 2
7  2 3 1
8  2 3 2
9  3 3 1
10 3 4 2
11 3 4 1
12 3 4 2
library(data.table)
dt <- as.data.table(df)
library(dplyr)
------------------------------------------------
data.table + dplyr code now lives in dtplyr.
Please library(dtplyr)!
------------------------------------------------

Attaching package: 'dplyr'
The following objects are masked from 'package:data.table':

    between, first, last
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
tbl <- tbl_df(df)


# data.frame
unique(df)
   A B C
1  1 1 1
2  1 1 2
4  1 2 2
5  2 2 1
6  2 2 2
7  2 3 1
8  2 3 2
9  3 3 1
10 3 4 2
11 3 4 1
# data.table
unique(dt)
    A B C
 1: 1 1 1
 2: 1 1 2
 3: 1 2 2
 4: 2 2 1
 5: 2 2 2
 6: 2 3 1
 7: 2 3 2
 8: 3 3 1
 9: 3 4 2
10: 3 4 1
# dplyr
library(dplyr)
distinct(tbl)
# A tibble: 10 × 3
       A     B     C
   <int> <int> <int>
1      1     1     1
2      1     1     2
3      1     2     2
4      2     2     1
5      2     2     2
6      2     3     1
7      2     3     2
8      3     3     1
9      3     4     2
10     3     4     1

Voir aussi duplicated.