View source: R/data_duplicated.R
data_duplicated | R Documentation |
Extract all duplicates, for visual inspection.
Note that it also contains the first occurrence of future
duplicates, unlike duplicated()
or dplyr::distinct()
). Also
contains an additional column reporting the number of missing
values for that row, to help in the decision-making when
selecting which duplicates to keep.
data_duplicated(
data,
select = NULL,
exclude = NULL,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE
)
data |
A data frame. |
select |
Variables that will be included when performing the required tasks. Can be either
If |
exclude |
See |
ignore_case |
Logical, if |
regex |
Logical, if |
verbose |
Toggle warnings. |
A dataframe, containing all duplicates.
data_unique()
df1 <- data.frame(
id = c(1, 2, 3, 1, 3),
year = c(2022, 2022, 2022, 2022, 2000),
item1 = c(NA, 1, 1, 2, 3),
item2 = c(NA, 1, 1, 2, 3),
item3 = c(NA, 1, 1, 2, 3)
)
data_duplicated(df1, select = "id")
data_duplicated(df1, select = c("id", "year"))
# Filter to exclude duplicates
df2 <- df1[-c(1, 5), ]
df2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.