I'm trying to get the data from column one that matches with column 2 but only on the "B" values. Need to somehow make the true values a list. Need this to repeat for 50,000 rows. Around 37,000 of them are true. I'm incredibly new to this so any help would be nice.
Data <- data.frame(
X = sample(1:10),
Y = sample(c("B", "W"), 10, replace = TRUE)
)
Count <- 1
If(data[count,2] == "B") {
List <- list(data[count,1]
Count <- count + 1
#I'm not sure what to use to repeat I just put
Repeat
} else {
Count <- count + 1
Repeat
}
End result should be a list() of only column one data. In this if rows 1-5 had "B" I want the column one numbers from that.