I have two data frames with many cases. One of time 1 and one of time 2. I am looking for a way to quickly identify cases where changes have occurred between time 1 and time 2, and I'm a bit stuck.
Here is an example. So, I have a data frame from time 1,
df.t1 <- data.frame(id = c(1,1,1,2,2,3,3,5,5,6), ABC = LETTERS[1:10], Num = 101:110)
and looks like this:
df.t1
id ABC Num
1 1 A 101
2 1 B 102
3 1 C 103
4 2 D 104
5 2 E 105
6 3 F 106
7 3 G 107
8 5 H 108
9 5 I 109
10 6 J 110
time when two rolls around
df.t2 <- df.t1
and there are some changes
df.t2[3,3] <- 104
df.t2[2,2] <- "H"
df.t2[8,3] <- 999
df.t2[10,3] <- NA
df.t2[11,] <- c(3, "J", 107)
it's time 2,
df.t2
id ABC Num
1 1 A 101
2 1 H 102
3 1 C 104
4 2 D 104
5 2 E 105
6 3 F 106
7 3 G 107
8 5 H 999
9 5 I 109
10 6 J <NA>
11 3 J 107
Now Iβm looking for a quick way to remove cases, all identifiers, for cases when in case (NO) there were NO changes (any line) between time1 and time 2. In a specific example, it is only with id # 2 that no changes have occurred between time 1 and time 2.
I am looking for an end result that looks like this:
(df <- subset(df.t2, id != 2))
id ABC Num
1 1 A 101
2 1 H 102
3 1 C 104
6 3 F 106
7 3 G 107
8 5 H 999
9 5 I 109
10 6 J <NA>
11 3 J 107
Any help would be appreciated.