corner is a small R package for quick, simple, console-width-aware object inspection.
It provides two functions: corner() and peek().
corner() is width-aware by default: it reads your active console width,
prints a top-left preview that fits, and avoids wrapped output.
It works directly with base data.frame and matrix objects, and with
data.frame subclasses such as tibble and data.table.
peek() recursively inspects lists and prints each item name (or index),
type and dimensions/length.
When given a matrix or data frame, peek() calls corner().
When given a vector, peek() prints metadata on line one and a width-aware,
truncated vector preview on line two.
I first put corner together years ago because I got tired of accidentally
dumping huge objects to my console when I was just trying to sanity-check that
a command did what I expected.
The usual quick-inspection tools often felt a bit awkward for this workflow:
head()on a wide object is a nightmare, and head(x, c(4, 6)) just felt unnecessary each time you want a small top-left peek.- Typing row/column indexing like
1:4and1:6over and over gets old fast! - Tibble-style printing can be slower on really large objects, and sometimes includes extra column-summary detail I do not need in the moment.
So corner() is built to stay lightweight: minimal typing, width-aware output,
no wrapping, and a quick preview you can scan instantly.
peek() takes the same idea to lists. It makes nested structures easier to
scan so you can find what you need without manually stepping through names and
indices one by one.
Install from github with:
# install.packages("pak")
pak::pak("lpembleton/corner")Set up corner to autoload in your project startup:
- Vignette (source): Auto-load corner in a workspace
- Open in R:
vignette("auto-load-corner", package = "corner")
library(corner)
corner(mtcars) # auto fit to console
corner(mtcars, n = 5) # first 5 rows and first 5 columns
corner(mtcars, r = 4) # first 4 rows, auto columns
corner(mtcars, c = 6) # first 6 columns, auto rows
corner(mtcars, r = 4, c = 6)
corner(mtcars, r = 4, c = 6, skip_rows = 2, skip_cols = 1)
# built-in wide test dataset
data(genotype_matrix)
corner(genotype_matrix)
x <- list(
samples = genotype_matrix[1:4, 1:6],
meta = list(site = "field-1", years = 2020:2022),
1:5
)
peek(x)
# vector preview (truncated with ... when long)
peek(1:20)When citing the use of this package, please use:
library(corner)
citation("corner")
#> To cite package 'corner' in publications use:
#>
#> Pembleton, L. (2026). corner: Quick, Console-Width-Aware Object
#> Inspection. R package version 0.1.0.9000.
#> https://github.com/lpembleton/corner
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {corner: Quick, Console-Width-Aware Object Inspection},
#> author = {Luke Pembleton},
#> year = {2026},
#> note = {R package version 0.1.0.9000},
#> url = {https://github.com/lpembleton/corner},
#> }