Re-extracting a slice using dplyr
taking the following data
A <- c(4,4,4,5,5,5,5,6,6)
B <- c(1,2,3,1,3,4,3,2,7)
data1 <- data.frame(A,B)
I want to remove duplicate B values for each A.
So my new table should delete data1[7,]
I want to use a package dplyr()
AND have tried the following code
data2 <- data1 %>%
group_by(A) %>%
filter(slice(B(1)))
Can someone help me with the correct command filter()
+3
source to share