Re: [R] Create matrix with subset from unlist

2010-02-01 Thread David Winsemius
On Feb 1, 2010, at 9:38 AM, Muhammad Rahiz wrote: Hello all, Thanks for all your replies. Usually, when I make a post to the R-mailing list, I would keep on trying to get the solution myself rather than waiting for one. At times, I was able to derive my own solution. This would explain wh

Re: [R] Create matrix with subset from unlist

2010-02-01 Thread Muhammad Rahiz
Hello all, Thanks for all your replies. Usually, when I make a post to the R-mailing list, I would keep on trying to get the solution myself rather than waiting for one. At times, I was able to derive my own solution. This would explain why my solution and that of Dennis's produces the same r

Re: [R] Create matrix with subset from unlist

2010-01-29 Thread David Winsemius
On Jan 29, 2010, at 1:07 PM, Muhammad Rahiz wrote: OK, I've got this. The output prints what I want, but I'm not sure if there will be problems in further analysis because the main idea is to convert the data from list to matrix. I'm quite concerned with how I define xx2. xx <- unlist(

Re: [R] Create matrix with subset from unlist

2010-01-29 Thread Muhammad Rahiz
OK, I've got this. The output prints what I want, but I'm not sure if there will be problems in further analysis because the main idea is to convert the data from list to matrix. I'm quite concerned with how I define xx2. xx <- unlist(x) # Unlist from lapply + read.table a <- seq(1,1

Re: [R] Create matrix with subset from unlist

2010-01-29 Thread David Winsemius
On Jan 29, 2010, at 12:43 PM, Muhammad Rahiz wrote: Thanks David & Dennis, I may have found something. Given that the object xx is the product of unlist(x), to create a 2x2 matrix with subsets, I could do, > y <- matrix(xx[c(1:4)], 2, 2). This returns, [,1] [,2] [1,] -27.3 14.4 [2

Re: [R] Create matrix with subset from unlist

2010-01-29 Thread Muhammad Rahiz
Thanks David & Dennis, I may have found something. Given that the object xx is the product of unlist(x), to create a 2x2 matrix with subsets, I could do, > y <- matrix(xx[c(1:4)], 2, 2). This returns, [,1] [,2] [1,] -27.3 14.4 [2,] 29.0 -38.1 If I do, > y2 <- matrix(xx[c(5:8)],2,2

Re: [R] Create matrix with subset from unlist

2010-01-29 Thread David Winsemius
On Jan 29, 2010, at 9:45 AM, Dennis Murphy wrote: Hi: The problem, I'm guessing, is that you need to assign each of the matrices to an object. There's undoubtedly a slick apply family solution for this (which I want to see, BTW!), I don't have a method that would assign names but you c

Re: [R] Create matrix with subset from unlist

2010-01-29 Thread Dennis Murphy
Hi: The problem, I'm guessing, is that you need to assign each of the matrices to an object. There's undoubtedly a slick apply family solution for this (which I want to see, BTW!), but here's the brute force method using a loop: nms <- paste('x', 1:32, sep = "") for(i in seq_along(nms)) assign(nm