longdf2matrix function

Convert a long-format data frame into matrix