I tried to use acast from reshape2 within a self written function, but had the problem that acast did not find the data I send to it.
acast
reshape2
Here is m
Instead of using the formula specification, use the character specification:
acast(y, list(names(y)[1], names(y)[2]))