Description Usage Arguments Author(s) Examples
Show a corner (top-left, top-right, bottom-left, bottom-right) of a data frame.
1 | corner(dfr, n = 6, thecorner = "topleft")
|
dfr |
|
n |
|
thecorner |
Joost van de Weijer
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])
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.