I am utilising a dataset that includes one column that comprises of phone numbers, and one column that includes yes or no.
phone.number yes.no
1 7539339393 Y
2 111111111 N
3 1234567890 Y
4 7539339393 N
5 1222222222 Y
6 3333333333 N
7 4444444444 Y
8 5555555555 N
9 7539339393 Y
dput
below:
structure(list(phone.number = structure(c(7L, 1L, 3L, 7L, 2L,
4L, 5L, 6L, 7L), .Label = c("111111111", "1222222222", "1234567890",
"3333333333", "4444444444", "5555555555", "7539339393"), class = "factor"),
yes.no = structure(c(2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("N",
"Y"), class = "factor")), .Names = c("phone.number", "yes.no"
), row.names = c(NA, -9L), class = "data.frame")
There are two things that I'd really appreciate some help with.
I am trying to create a subset that includes all phone numbers that have been repeated 3 or more times within the dataset. So, in the example provided, the number 7539339393 is repeated 3 times, the subset that I'd like to make would just include these observations and the corresponding yes and no values.
I am also trying to subset for all phone numbers that have returned yes and no. So, within the dataset provided, 7539339393 has corresponded to both yes and no, I'd like to create a subset with all of the phone numbers that return both and all of the corresponding yes and no values