short {cgwtools} | R Documentation |
Returns a small sample of the specified data set.
Description
The user specifies both the number of elements to display and the number of elements at the start and end of the vector to ignore ('skip') when selecting elements. The results are displayed in a nice tabular form. There are options to set the value of N as well as the number of values to "skip" before selecting the values. short
is similar to a combination of the unix head
and tail
functions.
Usage
short(x = seq(1, 20), numel = 4, skipel = 0, ynam = deparse(substitute(x)), dorows=FALSE)
Arguments
x |
The data vector to be examined. |
numel |
How many elements to display. Note that |
skipel |
If desired, skip the first |
ynam |
Not normally changed by the user. |
dorows |
For matrices only, return the "numel" number of rows rather than elements. |
Details
If the argument x
happens to be a list, short
unlists everything, so the first numel
values will be taken from the first list element, going on to the second element as needed, etc.
Value
Nothing is returned of interest. The function is called to provide what is printed directly to the console, which is a formatted table of the lead and tail values selected, with column labels identifying their location in the input vector object.
Author(s)
Carl Witthoft carl@witthoft.com
See Also
Examples
foo<-matrix(runif(100),nrow=20)
short(foo)
short(foo,numel=6,skipel=10)
short(foo,numel=6,skipel=10,dorows=TRUE)