Reputation: 193
Having a data frame as below, I need to group by the data frame by "ID" and next remove the rows with repetitive value for column "course"?
ID time course
1 ID01 01.10.2012 Math
2 ID01 10.11.2012 Math
3 ID01 01.01.2013 Math
4 ID01 01.01.2013 History
5 ID02 10.01.2013 Math
6 ID02 02.05.2013 Math
7 ID02 15.01.2013 History
I need to have this:
1 ID01 01.10.2012 Math
4 ID01 01.01.2013 History
5 ID02 10.01.2013 Math
7 ID02 15.01.2013 History
dput(test)
structure(list(ID = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("ID01",
"ID02"), class = "factor"), time = structure(c(1L, 2L, 3L, 3L,
4L, 5L, 6L), .Label = c("01.10.2012", "10.11.2012", "01.01.2013",
"10.01.2013", "02.05.2013", "15.01.2013"), class = "factor"),
course = structure(c(1L, 1L, 1L, 2L, 1L, 1L, 2L), .Label = c("Math",
"History"), class = "factor")), .Names = c("ID", "time",
"course"), row.names = c(NA, 7L), class = "data.frame")
Upvotes: 0
Views: 126