Fixed the row-wise vs column-wise issue at the R interface.