I have the follow df:
set.seed(126)
df <- data.frame(
x = replicate(2, sample(1:25, 25, replace = TRUE))
)
For return distinct values:
library(tidyverse)
library(magrittr)
df %>% distinct(x.1) %>% count()
# A tibble: 1 x 1
n
<int>
1 17
But, I want return duplicated values, instead distincts. I try:
df %>% !distinct(x.1) %>% count()
Error in distinct(x.1) : object 'x.1' not found
df %>% negate(distinct(x.1)) %>% count()
Error: Can't convert a
data.frameobject to function
df_1 %>% not(distinct(x.1)) %>% count()
Error in distinct(x.1) : object 'x.1' not found
- I need of a function that invert
tidyversefunctions.
df[duplicated(df$x.1),], and the distinct values are given bydf[!duplicated(df$x.1),]- IceCreamToucan