Displaying 1 result from an estimated 1 matches for "rowcrop".
Did you mean:
rowcol
2012 Nov 11
2
Cropping a matrix by rows
...segments by rows. I want to be able to return each
segment as a newly named object. I've tried looking at the apply functions
and creating a for loop but brain no work. Here's the basic starting
objects that I believe would be needed to separate the matrix.
mat <- matrix(c(1:40),10,4)
rowcropping <- sort(sample(2:9,2))
rowcropping <- c(1,rowcropping,length(mat[,1]))
mat[rowcropping[1]:rowcropping[2],]
I want something like the last line as the first object but getting them
all by automation as separate objects is my goal. Thanks.
[[alternative HTML version deleted]]