How to remove duplicate rows from data frame in R

1 Answer

0 votes
df = data.frame(a = c(1, 3, 1, 0),
                b = c(12, 98, 12, 20),
                c = c(2, 4, 2, 8),
                d = c(13, 77, 13, 20),
                row.names = c('o', 'p', 's', 't'))

print(df)

df = unique(df)

print(df)



      
      
# run:
#
#   a  b c  d
# o 1 12 2 13
# p 3 98 4 77
# s 1 12 2 13
# t 0 20 8 20
#   a  b c  d
# o 1 12 2 13
# p 3 98 4 77
# t 0 20 8 20
# 

 



answered Jul 8, 2021 by avibootz

Related questions

1 answer 345 views
1 answer 350 views
1 answer 309 views
1 answer 281 views
1 answer 409 views
1 answer 321 views
1 answer 360 views
360 views asked Jul 8, 2021 by avibootz
...