
Last chance! 50% off unlimited learning
Sale ends in
this returns a character vector which shows the top n lines of a file.
Note: I realized after the fact that this is essentially a duplicate
of the base R function readLines
.
peek(x, n = 2)
a filename
the number of lines to return
Michael I. Love
filename <- tempfile()
x<-matrix(round(rnorm(10^4),2),1000,10)
colnames(x)=letters[1:10]
write.csv(x,file=filename,row.names=FALSE)
peek(filename)
Run the code above in your browser using DataLab