Learn R Programming

useful (version 1.2.6)

WhichCorner: WhichCorner

Description

Function to build the right row selection depending on the desired corner.

Usage

WhichCorner(corner = c("topleft", "bottomleft", "topright",
  "bottomright"), r = 5L, c = 5L, object = "x")

Value

An expression that is evaluated to return the proper portion of the data

Arguments

corner

(character) which corner to display c("topleft", "bottomleft", "topright", "bottomright")

r

(numeric) the number of rows to show

c

(numeric) the number of columns to show

object

The name of the object that is being subsetted

Author

Jared P. Lander

Details

Function to build the right row selection depending on the desired corner. Helper function for getting the indexing for data.frame's, matrices

Examples

Run this code
if (FALSE) {
WhichCorner('topleft')
WhichCorner('bottomleft')
WhichCorner('topright')
WhichCorner('bottomright')

WhichCorner('topleft', r=6)
WhichCorner('bottomleft', r=6)
WhichCorner('topright', r=6)
WhichCorner('bottomright', r=6)

WhichCorner('topleft', c=7)
WhichCorner('bottomleft', c=7)
WhichCorner('topright', c=7)
WhichCorner('bottomright', c=7)

WhichCorner('topleft', r=8, c=3)
WhichCorner('bottomleft', r=8, c=3)
WhichCorner('topright', r=8, c=3)
WhichCorner('bottomright', r=8, c=3)
}

Run the code above in your browser using DataLab