Return the middle portion of data similar to head and tail

middle(x, n = 10, evenly = TRUE, ...)

Arguments

x

input data that can be subset

n

numeric number of entries to return

evenly

logical indicating whether to return evenly spaced entries along the full length of x. When evenly=FALSE only the middle n entries are returned.

...

additional arguments are ignored.

Details

This function is very simple, and is intended to mimic head() and tail() to inspect data without looking at every value

Examples

x <- 1:101;
middle(x);
#>  [1]   1  12  23  34  45  57  68  79  90 101
middle(x, evenly=TRUE)
#>  [1]   1  12  23  34  45  57  68  79  90 101

xdf <- data.frame(n=1:101,
   excel_colname=jamba::colNum2excelName(1:101));
middle(xdf)
#>       n excel_colname
#> 1     1             A
#> 12   12             L
#> 23   23             W
#> 34   34            AH
#> 45   45            AS
#> 57   57            BE
#> 68   68            BP
#> 79   79            CA
#> 90   90            CL
#> 101 101            CW
middle(xdf, evenly=TRUE)
#>       n excel_colname
#> 1     1             A
#> 12   12             L
#> 23   23             W
#> 34   34            AH
#> 45   45            AS
#> 57   57            BE
#> 68   68            BP
#> 79   79            CA
#> 90   90            CL
#> 101 101            CW