(This article was first published on Shravan Vasishth's Slog (Statistics blog), and kindly contributed to R-bloggers)
I foolishly tried to convert a matrix M to a vector using vector:vector(M)
But this is done column wise, so that adjacent row items end up non-adjacent.
The right way to do this seems to be:
library(data)
unmatrix(M, byrow=TRUE)
To leave a comment for the author, please follow the link and comment on his blog: Shravan Vasishth's Slog (Statistics blog).
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

Zero Inflated Models and Generalized Linear Mixed Models with R.
Zuur, Saveliev, Ieno (2012).