I'm still new to R and feel there has to be a better way to do what I've done. I am trying to compare a process and determine if it fits specific sequence.... Also, later I'm planning on expanding this to say, if sequence A, then "cool", else if sequence b then "kinda cool", else, "not cool at all".
For the sample data, let's determine if bakers are following the correct steps for baking a recipe.
merged_data <-(sampledata,proper_sequence, "sequence description")
 1. Baker    Actual_Sequence_#   Sequence     proper sequence
 3. John        1         Bought ingredients    1
 4. John        2         Read recipe           1
 5. Jack        1         Read recipe           1
 6. Jack        2         Bought ingredients    1
 7. Jack        3         Mixed ingredients     3
 8. Jack        4         Preheated oven        2
 9. Jane        1         Preheated oven        2
 10. Jane       2         Bought ingredients    1
 11. Jill       1         Mixed ingredients     2
#spread the data by actual sequence and fill with proper sequence; I feel this step could be cut out, but not sure how.
spread_data<- spread(sampledata,key = "Actual_Sequence_#",value = "proper sequence")
1. Baker     1   2   3   4
2. John      1   1      
3. Jack      1   1   3   2
4. Jane      2   1      
5. Jill      2
concatenate and eliminate duplicates
I actually need help with this bit of code. desired outcome is a two column data frame
condensed_data<- spread_data(group_by(Baker),????)
1. Baker Sequence  concactenated 
2. John      1      
3. Jack      1,3,2
4. Jane      2,1      
5. Jill      2
add a new column that evaluates concatenated actual sequence with proper sequence
evaluation <- mutate(eval_of_sequence=
ifelse(grepl("1,2,3,4",condensed_data$`concatenated`),"following proper sequence",
ifelse(grepl("1,2,3",condensed_data$`concatenated`),"following proper sequence",
ifelse(grepl("1,2",condensed_data$`concatenated`),"following proper sequence",
ifelse(grepl("1",condensed_data$`concatenated`),"following proper sequence", 
"breaking proper sequence"))
1. Baker  Sequence_concatenated  evaluation
2. John      1           following proper sequence
3. Jack      1,3,2       breaking proper sequence 
4. Jane      2,1         breaking proper sequence 
5. Jill      2           following proper sequence
 
    