Re: [R] matrix rows to single numeric element

2011-08-04 Thread R. Michael Weylandt
> This seems to work: > > apply(mat1,1,function(x){paste(x,collapse="")}) > > The collapse command inside of paste is (I think) the easiest way to > combine strings. > > Michael Weylandt > > > On Thu, Aug 4, 2011 at 5:45 PM, Wegan, Michael (DNRE) > wrote: > >> I have a matrix of 5 columns and 64 r

[R] matrix rows to single numeric element

2011-08-04 Thread Wegan, Michael (DNRE)
I have a matrix of 5 columns and 64 rows, let's call it "mat1". All values are 1 or 0. I need to take the values of the elements by row and create a single numeric element that can be placed its respective slot in a 64-element list, named "list1". For example, mat1[11,1:5] = 0,1,1,0,1 and I m