Learn R Programming

wordspace (version 0.2-8)

head.dist.matrix: 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 dist.matrix
head(x, n = 6L, k = n, ...)

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.

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

Author

Stephanie Evert (https://purl.org/stephanie.evert)

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.

See Also

head for the generic method.

Examples

Run this code

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

Run the code above in your browser using DataLab