我希望有一个变量的数据帧,具有原始数据帧的相应唯一值(基于阈值).换句话说,如果一列的唯一值少于5个,则应该将其作为行添加到新的数据帧中. 例如,基于以下数据帧
structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), gender = c("male",
"female", "female", "female", "female", "male", "male", "female",
"female", "female"), ranking = c("low", "medium", "medium", "medium",
"high", "low", "medium", "low", "low", "low"), comments = c("I was really dissapointed by the fact that there was no response",
"I got feedback from them but I considered it a lie", "The feedback was really good and I felt convinced",
"I was informed they will get back to me", "The feedback was appropriate to me",
"I feel the contact person wasn't knowledgeable about the product",
"I was told they will follow up within a week but they failed to",
"I liked their customer service", "I was told that the issue will soon be addressed",
"I am satisfied with the resonse they gave")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -10L))
预期的结果将是