Hello, I am having issues trying to remove duplicates from the data. I believe I have entered the correct function, but an error keeps showcasing as you can see below While I have looked up the reason why this error may be occurring, I don't see the issue. Can someone provide some assisant. Thank you
Divvy_Trips_2015_Q1<- Divvy_Trips_2015_Q1 %/%
distinct("bike_id", .keep_all = TRUE)
Error in UseMethod("distinct") :
no applicable method for 'distinct' applied to an object of class "character"
The error occurs because the distinct() function is being applied incorrectly. The argument .keep_all = TRUE should be passed within the distinct() function to preserve other columns, and the syntax for filtering by bike_id needs to be corrected. Here's the correct approach:
Divvy_Trips_2015_Q1 <- Divvy_Trips_2015_Q1 %>%
distinct(bike_id, .keep_all = TRUE)
Ensure you are using the dplyr package. You can check if it's loaded using: