View source: R/dataframe_tools.R
top_tail | R Documentation |
First and last rows of a dataframe
top_tail(df, top = 3, tail = 3)
df |
(Dataframe) A dataframe. |
top |
(Integer) The number of rows to get from the start of |
tail |
(Integer) The number of rows to get from the end of |
0
can be provided for the top and tail, in which case it will behave like
head()
and tail()
respectively.
A dataframe.
Desi Quintans (http://www.desiquintans.com)
# Returns 6 rows by default, just like head() does.
top_tail(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> 148 6.5 3.0 5.2 2.0 virginica
#> 149 6.2 3.4 5.4 2.3 virginica
#> 150 5.9 3.0 5.1 1.8 virginica
top_tail(iris, top = 1, tail = 2)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.2 setosa
#> 149 6.2 3.4 5.4 2.3 virginica
#> 150 5.9 3.0 5.1 1.8 virginica
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.