headhead function

head/tail function for matrix or data.frame