I have a table of 7 columns, the first column is id, then 3 columns of vegetable types and the last 3 columns are fruit types. The values indicate whether a person has this vegetable/ fruit. Is there a way to group the vegetables and the fruits, and output the column names if the person has that vegetable/ fruit?

Input data frame:

```
id1 <- c("id_1", 1, NA, NA, NA, 1, NA)
id2 <- c("id_2", NA, 1, 1, NA, NA, NA)
input <- data.frame(rbind(id1, id2))
colnames(input) = c("id", "lettuce", "tomato", "bellpeper", "pineapple", "apple", "banana")

```

Expected output data frame:

```
output_id1 <- c("id_1", "lettuce", "apple")
output_id2 <- c("id_2", "tomato, bellpeper", NA)
output <- data.frame(rbind(output_id1, output_id2))
colnames(output) <- c("id", "veg", "fruit")

```