So I have a large dataset that looks something like this:
df <- data.frame(ID =c("A","A","A","B","B","B","C","C","C"),
plot = c(1,1,1,2,2,3,4,5,5))
df
ID plot
1 A 1
2 A 1
3 A 1
4 B 2
5 B 2
6 B 3
7 C 4
8 C 5
9 C 5
I want to keep just the first values from plot
so the data looks like this in the end:
df1 <- data.frame(ID =c("A","A","A","B","B","B","C","C","C"),
plot = c(1,1,1,2,2,2,4,4,4))
df1
ID plot
1 A 1
2 A 1
3 A 1
4 B 2
5 B 2
6 B 2
7 C 4
8 C 4
9 C 4