Extract matrix from specified place in a data fram

katxt

Active Member
#1
Hi folks.
Is there a quick way to get a matrix with the data from, say, (2, 5) to (15, 20) in a given data frame?
Cheers, kat
 

Dason

Ambassador to the humans
#2
Are you saying the data in rows 2 to 5 and only columns 15 to 20? If so

mydf[2:5, 15:20]

And if you want it converted to matrix just wrap that in as.matrix