R: Return the Top Left Corner of a Distance Matrix (wordspace)

head.dist.matrix {wordspace} | R Documentation

## Return the Top Left Corner of a Distance Matrix (wordspace)

### Description

Returns the first `n` rows and first `k` columns of a distance matrix returned by the `dist.matrix` function.

### Usage

    ## S3 method for class 'dist.matrix'
    head(x, n = 6L, k = n, ...)

### Arguments

`x` | an distance matrix of class `dist.matrix`
`n` | a single integer specifying the number of rows to extract
`k` | a single integer specifying the number of columns to extract (default: same as number of rows)
`...` | all other arguments are silently ignored

### Details

Note that in contrast to other `head` methods, negative values of `n` (and `k`) are not supported. There is also currently no corresponding `tail` method.

### Value

A numeric matrix with `n` rows and `k` columns.

Note: this matrix is no longer marked as an object of class `dist.matrix` and thus prints nicely without attributes.

### Author(s)

Stefan Evert (http://purl.org/stefan.evert)

### See Also

`head` for the generic method.

### Examples

    dm <- dist.matrix(DSM_Vectors[1:100, ])
    print(head(dm, 8, 5), digits=3)

[Package wordspace version 0.2-6 Index]