df.head | R Documentation |
The function df.head
prints the first rows of a data frame and the
function df.tail
prints the last rows of a data frame and prints as
many columns as fit on the console supplemented by a summary of the remaining
rows and columns.
df.head(data, n = 6, digits = 3, width = 20, factor.labels = TRUE,
row.names = TRUE, row.names.col = "gray2", message = TRUE,
message.col = "b.blue", check = TRUE, output = TRUE)
df.tail(data, n = 6, digits = 3, width = 20, factor.labels = TRUE,
row.names = TRUE, row.names.col = "gray2", message = TRUE,
message.col = "b.blue", check = TRUE, output = TRUE)
data |
a data frame. |
n |
a numeric value indicating the number of rows to be printed on the console. |
digits |
a numeric value indicating the maximum number of decimal places to be used. |
width |
a numeric value indicating the maximum width of the character strings in the vector. |
factor.labels |
logical: if |
row.names |
logical: if |
row.names.col |
a character string indicating the text color for the row
names, see |
message |
logical: if |
message.col |
a character string indicating the text color for the
number of remaining rows and columns printed on the
console, see |
check |
logical: if |
output |
logical: if |
Returns a list with following entries:
df |
data frame specified in |
row.col |
character string indicating the remaining rows and columns |
Takuya Yanagida
df.check
, head
, tail
, freq
, descript
# Example 1: Print first and last six rows
df.head(mtcars)
df.tail(mtcars)
# Example 2: Print first and last six rows without row names
df.head(mtcars, row.names = FALSE)
df.tail(mtcars, row.names = FALSE)
# Example 3: Print first and last three rows with one max. number of decimal places
df.head(mtcars, n = 3, digits = 1)
df.head(mtcars, n = 3, digits = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.