Add matrix support to write.tidy