Нам нужна группа по последовательности
df %>%
select(-weight) %>%
group_by(id, time) %>%
mutate(ind = paste0("Fish", row_number())) %>%
spread(ind, fish)
# A tibble: 4 x 4
# Groups: id, time [4]
# id time Fish1 Fish2
# <int> <int> <chr> <chr>
#1 1 1 marlin cod
#2 1 2 cod NA
#3 2 1 salmon cod
#4 2 2 cod NA
data
df <- structure(list(id = c(1L, 1L, 1L, 2L, 2L, 2L), time = c(1L, 1L,
2L, 1L, 1L, 2L), fish = c("marlin", "cod", "cod", "salmon", "cod",
"cod"), weight = c(4L, 1L, 1L, 2L, 2L, 3L)), .Names = c("id",
"time", "fish", "weight"), class = "data.frame", row.names = c("1",
"2", "3", "4", "5", "6"))