This to the beginning:

strt<-Sys.time()

And this to the end:

print(Sys.time()-strt)

Example output:

> print(Sys.time()-strt)
Time difference of 16.39691 secs