I must turn a sizable dataset into a matrix. The below data "x" is liked by the data structure. Due to the large dataset's memory requirements, the function tapply that I used to accomplish it (see below) is unable to function. If there is a different approach, please let me know. I attempted to do it for the R package dplyr but was unable to. Any ideas on how to do that? Much appreciated.

data.frame(c1=c("A","B","C","A","B","C"), c2=1:6, c3=c("sp1","sp2","sp2","sp3","sp4")) returns the value x.

y = tapply(x$c2, list(x$c1, x$c3), sum).