How can I select, say top 100 rows of a matrix in R? All I found is using subset which requires condition parameter. All I need to make smaller matrix by using only first n
Use the head function:
head
head(mat, 100)
The simplest way to do it would be a[1:100,] (unless there are fewer than 100 rows, in which case head(a,100) works better)
a[1:100,]