I would like to subset my dataframe by removing rows which have same values in a specific column.
Here my dataframe:
ID Area Date Day
1 21009 4390.0 1979-12-27 4835
2 24005 178.5 1979-12-27 4835
3 27001 484.3 1979-12-27 4835
4 27002 758.9 1979-12-27 4835
5 38003 133.9 1979-12-27 4835
6 33014 272.0 2004-02-01 13637
7 33029 98.8 2004-02-01 13637
8 34003 164.7 2004-02-01 13637
9 23118 220.8 2007-01-18 14502
My output should be:
ID Area Date Day
1 21009 4390.0 1979-12-27 4835
2 33014 272.0 2004-02-01 13637
3 23118 220.8 2007-01-18 14502
I tried but didn't work:
df <- subset(df, Day == unique(Day))
and
df <- df[df == unique(df$Day), ]
Whereas the following code only return me a vector with unique(df$Day)
, which is good, but I need all the dataframe subsetted:
df <- unique(df[ , 4] )