corner: Show one of the four corners of a data frame.

Description Usage Arguments Author(s) Examples

View source: R/corner.R

Description

Show a corner (top-left, top-right, bottom-left, bottom-right) of a data frame.

Usage

1
corner(dfr, n = 6, thecorner = "topleft")

Arguments

dfr
n
thecorner

Author(s)

Joost van de Weijer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (dfr, n = 6, thecorner = "topleft")
{
    if (is.character(n)) {
        thecorner = n
        n = 6
    }
    dfr = data.frame(dfr)
    n = ifelse(n > min(ncol(dfr), nrow(dfr)), min(ncol(dfr),
        nrow(dfr)), n)
    if (thecorner == "topright")
        print(dfr[1:n, (ncol(dfr) - (n - 1)):ncol(dfr)])
    else if (thecorner == "bottomleft")
        print(dfr[(nrow(dfr) - (n - 1)):nrow(dfr), 1:n])
    else if (thecorner == "bottomright")
        print(dfr[(nrow(dfr) - (n - 1)):nrow(dfr), (ncol(dfr) -
            (n - 1)):ncol(dfr)])
    else print(dfr[1:n, 1:n])
  }

vdweijer/supply documentation built on June 28, 2021, 7:45 a.m.