Try:
library(dplyr)
library(tidyr)
df %>%
group_by(id1) %>%
mutate(id = row_number()) %>%
gather(key, value, -(id1:info), -id) %>%
unite(id_key, id, key) %>%
spread(id_key, value)
Which gives:
#Source: local data frame [2 x 9]
# id1 id2 info 1_action_comment 1_action_time 2_action_comment 2_action_time 3_action_comment 3_action_time
#1 1 a info1 comment1 time1 comment2 time2 comment3 time3
#2 2 b info2 comment4 time4 comment5 time5 NA NA