I assiduously avoid automatically generating distinct objects, and recommend that you also do so. You have the data, and can refer to individual rows by index as you need them. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity.
Hans Thompson <hans.thomps...@gmail.com> wrote: >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. ______________________________________________ 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.