I am attempting to create a new data frame without the rows of duplicated values in column "id"
I've tried some options however I would like to keep things consistent and take advantage of dplyr
. I tried working with the distinct()
function but to no avail.
library(tidyverse)
df <- structure(list(id = c("1-2", "1-3", "1-3", "1-4",
"1-5", "1-7", "1-7", "1-7", "1-9",
"1-22"), award_amount = c(3000, 596500, 1125000, 5881515,
155555, 686500, 207718, 250000, 750000, 3500000)), row.names = c(NA,
-10L), class = c("tbl_df", "tbl", "data.frame"))
s4 <- df %>%
distinct(id, .keep_all = TRUE)
s4
I would like both rows containing duplicates in the "id" column to not exist in the final table