Q:

How to group column value by Creating list of column value in dataframe R

How to group column value by Creating list of column value  in dataframe R.
My dataframe,
CustNumber    Queue        CustID          ProNo#

1             Start         1               ESC

2             Start         1               Check

1             Start         1,1,1           hjju623,hjju623

1             Start         1,2,1,1         First44,ESC

2             Start         1,etc,ex        rere43

3             Start         1, 5597595494   151ss5151, 4949we49

I'm using below code to create list of column value by groping CustNumber,Queue.         
val<- df %>%
  gather(key,Value, -c(Queue,CustNumber)) %>%
  group_by(Queue,CustNumber, key,Value) %>%
  summarise(Count = n())%>%
  nest(key,Value,Count,.key = "listofvalues")

it gives . 
Queue     CustNumber    Key     listofvalues

Start       1          CustID   list(Value = c("1", "1,1,1", "1,2,1,1"), Count = c(1, 1, 1))

Start       1          ProNo#   list(Value = c("ESC", "First44,ESC", "hjju623,hjju623"), Count = c(1, 1, 1))

Start       2          CustID   list(Value = c("1", "1,etc,ex"), Count = c(1, 1))   

Start       2          ProNo#   list(Value = c("Check", "rere43"), Count = c(1, 1))  

Start       3          CustID   list(Value = "1, 5597595494", Count = 1)

Start       3          ProNo#   list(Value = "151ss5151, 4949we49", Count = 1)

But my Expected data frame is 
Queue     CustNumber    Key     listofvalues

Start       1          CustID   list(Value = c("1", "2"), Count = c(7,1))

Start       1          ProNo#   list(Value = c("ESC", "First44", "hjju623"), Count = c(2, 1, 2))

Start       2          CustID   list(Value = c("1", "etc","ex"), Count = c(2, 1,1))   

Start       2          ProNo#   list(Value = c("Check", "rere43"), Count = c(1, 1))  

Start       3          CustID   list(Value = "1", "5597595494", Count = c(1,1))

Start       3          ProNo#   list(Value = "151ss5151", "4949we49", Count = c(1,1))

Please help me to done this. 
dput of data frame. 
df<-structure(list(CustNumber = c("1", "2", "1", 
"1", "2", "3"), Queue = c("Start", "Start", 
"Start", "Start", "Start", "Start"), CustID = c("1", "1", "1,1,1", 
"1,2,1,1", "1,etc,ex", "1, 5597595494"), `ProNo#` = c("ESC", "Check", "hjju623,hjju623", 
"First44,ESC", "rere43", "151ss5151, 4949we49")), .Names = c("CustNumber", 
"Queue", "CustID", "ProNo#"), row.names = c(NA, 6L), class = "data.frame")

A:

We need to split up the string values.   Using separate_rows we can convert it to 'long' format and then within summarise get the unique 'Values' and the frequency with table
library(dplyr)
library(tidyr)
res <- df %>% 
         gather(key,Value, -c(Queue,CustNumber)) %>% 
         separate_rows(Value, sep=",") %>% 
         group_by(CustNumber, Queue, key) %>% 
         summarise(Count = list(list(Value = unique(Value),
                            Count = table(factor(Value, levels = unique(Value))))))

res$Count[[1]]
#$Value
#[1] "1" "2"

#$Count

#1 2 
#7 1 

