The comments are right on: you should provide your data, an example of what you've tried that demonstrates the problem, and preferably an example of the desired output. Please do that in the future.
Here's an example that hopefully simulates your situation:
set.seed(1) # for reproducible example
df <- data.frame(ID=c(1:5,1:3),
wave=c(rep(1,5),rep(2,3)),
x=rnorm(8))
df
# ID wave x
# 1 1 1 -0.6264538
# 2 2 1 0.1836433
# 3 3 1 -0.8356286
# 4 4 1 1.5952808
# 5 5 1 0.3295078
# 6 1 2 -0.8204684
# 7 2 2 0.4874291
# 8 3 2 0.7383247
Here's a solution using aggregate(...)
in base R.
# base R solution
IDS <- aggregate(wave~ID,df, function(x)length(x)>1)
df[df$ID %in% IDS[IDS$wave,]$ID,]
# ID wave x
# 1 1 1 -0.6264538
# 2 2 1 0.1836433
# 3 3 1 -0.8356286
# 6 1 2 -0.8204684
# 7 2 2 0.4874291
# 8 3 2 0.7383247
Here's a solution using data.table
.
# data.table solution
library(data.table)
setDT(df)[,lapply(.SD,function(x)x[.N>1]),by=ID]
# ID wave x
# 1: 1 1 -0.6264538
# 2: 1 2 -0.8204684
# 3: 2 1 0.1836433
# 4: 2 2 0.4874291
# 5: 3 1 -0.8356286
# 6: 3 2 0.7383247
And a simpler data.table solution (courtesy of @Arun).
setDT(df)[, if (.N > 1L) .SD, by=ID]
All of these select any rows having more than 1 (not exactly 2) waves for a given ID.