The head and tail method I posted a few days back runs into problems with matrices and data-frames (due to my use of cat()), and doesn’t tell you what it’s publishing when it shows you head and tail.
With some help from stack overflow I have now fixed those bugs …
ht <- function(d, m=5, n=m){ # print the head and tail together list <- NULL list[[paste0('HEAD #', m)]] <- head(d,m) list[[paste0('TAIL #', n)]] <- tail(d,n) return(list) }
Note, the return value is now the list – rather than NULL. For example:
> x <- 1:100 > v <- ht(x) > str(v) List of 2 $ HEAD #5: int [1:5] 1 2 3 4 5 $ TAIL #5: int [1:5] 96 97 98 99 100
Glad you’re enjoying it buddy. I’m using your function.
PS – If you ever package this up, you might want to use these Hadley tool:
https://github.com/hadley/devtools
Ohh, i already have!
That is the next blog post :)
Sent from my iPad
Top stuff!