Show both the head and tail of an R object

ht(x, n = 6L, m = n, returnList = FALSE, ...)

Arguments

x

The object to show

n

The number of elements to list for the head

m

The number of elements to list for the tail

returnList

Logical. Should the result be returned as a list

...

additional arguments passed to functions (not used at the moment)

Value

NULL unless returnList is set to TRUE in which case a list is returned

Details

This function does no error checking and it is up to the user to ensure that the input is indeed symmetric, positive-definite, and a matrix.

Examples

ht(trees)
#> Girth Height Volume #> 1 8.3 70 10.3 #> 2 8.6 65 10.3 #> 3 8.8 63 10.2 #> 4 10.5 72 16.4 #> 5 10.7 81 18.8 #> 6 10.8 83 19.7 #> ... #> Girth Height Volume #> 26 17.3 81 55.4 #> 27 17.5 82 55.7 #> 28 17.9 80 58.3 #> 29 18.0 80 51.5 #> 30 18.0 80 51.0 #> 31 20.6 87 77.0
ht(diag(20))
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] 1 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [2,] 0 1 0 0 0 0 0 0 0 0 0 0 0 0 #> [3,] 0 0 1 0 0 0 0 0 0 0 0 0 0 0 #> [4,] 0 0 0 1 0 0 0 0 0 0 0 0 0 0 #> [5,] 0 0 0 0 1 0 0 0 0 0 0 0 0 0 #> [6,] 0 0 0 0 0 1 0 0 0 0 0 0 0 0 #> [,15] [,16] [,17] [,18] [,19] [,20] #> [1,] 0 0 0 0 0 0 #> [2,] 0 0 0 0 0 0 #> [3,] 0 0 0 0 0 0 #> [4,] 0 0 0 0 0 0 #> [5,] 0 0 0 0 0 0 #> [6,] 0 0 0 0 0 0 #> ... #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] #> [15,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [16,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [17,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [18,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [19,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [20,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [,14] [,15] [,16] [,17] [,18] [,19] [,20] #> [15,] 0 1 0 0 0 0 0 #> [16,] 0 0 1 0 0 0 0 #> [17,] 0 0 0 1 0 0 0 #> [18,] 0 0 0 0 1 0 0 #> [19,] 0 0 0 0 0 1 0 #> [20,] 0 0 0 0 0 0 1
ht(1:20)
#> [1] 1 2 3 4 5 6 #> ... #> [1] 15 16 17 18 19 20
ht(1:20, returnList=TRUE)
#> $head #> [1] 1 2 3 4 5 6 #> #> $tail #> [1] 15 16 17 18 19 20 #>