Hi,
I know how to group_by, get_dupes, etc and use str_c to get the asterisk when I only have two duplicate id's but..... when my data frame has multiple duplicate id's I'm stuck. I need an asterisk on all fruits that are only from duplicate id's EXCEPT the last instance. I've inserted sample df and a df_new showing what I require.
Thanks in advance.
#sample dataframes
df <- data.frame (id = c("375", "400", "600", "600", "600",
"850", "850"),
name = c("John", "Peter", "Chris", "Chris", "Chris",
"Sam", "Sam"),
fruit = c("apple", "pear", "banana", "apple",
"strawberry", "grape", "apple")
)
df_new <- data.frame (id = c("375", "400", "600", "600", "600",
"850", "850"),
name = c("John", "Peter", "Chris", "Chris", "Chris",
"Sam", "Sam"),
fruit = c("apple", "pear", "banana*", "apple*",
"strawberry", "grape*", "apple")
)