I can print first n rows by the following command:
> dataset[1:n, ]
Is there a more elegant way to do this? Also, how can I print the last rows of a data set?
This question is related to
r
If you want to print the last 10 lines, use
tail(dataset, 10)
for the first 10, you could also do
head(dataset, 10)
Source: Stackoverflow.com