epi_head_and_tail: Print the first few rows and last few rows of a data frame

View source: R/epi_head_and_tail.R

epi_head_and_tailR Documentation

Print the first few rows and last few rows of a data frame

Description

epi_head_and_tail() prints the first and last few rows of a data.frame

Usage

epi_head_and_tail(df = NULL, rows = 5, cols = 5, last_cols = FALSE)

Arguments

df

data.frame as input

rows

Number of rows to print, default is 5

cols

Number of columns to print, default is 5

last_cols

Print the last columns instead of the first few, default is FALSE

Note

Similar to data.table printing of a data.table object but works for a tibble or data.frame, or any object that can be coerced to a data.frame

Author(s)

Antonio Berlanga-Taylor <https://github.com/AntonioJBT/episcout>

Examples


## Not run: 
n <- 20
df <- data.frame(
  var_id = rep(1:(n / 2), each = 2),
  var_to_rep = rep(c('Pre', 'Post'), n / 2),
  x = rnorm(n),
  y = rbinom(n, 1, 0.50),
  z = rpois(n, 2)
)
df
dim(df)
epi_head_and_tail(df)
epi_head_and_tail(df, rows = 2, cols = 2)
epi_head_and_tail(df, rows = 2, cols = 2, last_cols = TRUE)

## End(Not run)


AntonioJBT/episcout documentation built on Dec. 1, 2024, 4:07 a.m.