Hello r-help,

I've been banging my head against the computer in an attempt to learn how
to divide my matrix into 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]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to