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 numel elements of the beginning and of the end of the vector are returned.

skipel

If desired, skip the first skipel elements before returning numel elements.

ynam

Not normally changed by the user. ynam retrieves the name of the object in question, to be used in the output table formatting.

dorows

For matrices only, return the "numel" number of rows rather than elements. dorows is ignored with a warning if the input x has higher dimensionality.

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

head , tail

Examples

foo<-matrix(runif(100),nrow=20)
short(foo)
short(foo,numel=6,skipel=10)
short(foo,numel=6,skipel=10,dorows=TRUE)

[Package cgwtools version 4.1 Index]