Reputation: 171
Good night, i have a file like this
City Lat Long Mals
Bog 1m2sS 05M34W 2000
Bog 1m2sS 05M34W 2000
Bog 1m2sS 05M34W 3500
Bog 6m3sS 10M34W 3400
I want to get a file like the following:
City Lat Long Mals
Bog 1m2sS 05M34W 2000
Bog 1m2sS 05M34W 3500
Bog 6m3sS 10M34W 3400
Thanks for your help
Upvotes: 1
Views: 446
Reputation: 886998
We can use unique
from base R
unique(df1)
# City Lat Long Mals
#1 Bog 1m2sS 05M34W 2000
#3 Bog 1m2sS 05M34W 3500
#4 Bog 6m3sS 10M34W 3400
df1 <- structure(list(City = c("Bog", "Bog", "Bog", "Bog"), Lat = c("1m2sS",
"1m2sS", "1m2sS", "6m3sS"), Long = c("05M34W", "05M34W", "05M34W",
"10M34W"), Mals = c(2000L, 2000L, 3500L, 3400L)),
class = "data.frame", row.names = c(NA,
-4L))
Upvotes: 2
Reputation: 7385
It would help to have more information, like an example of your data.
You can use the janitor
package to identify duplicate responses:
library(janitor)
library(dplyr)
# Get all duplicates
df %>% get_dupes()
# Get duplicates for a specified variable
df %>% get_dupes(var_name)
Upvotes: 3