Re: [R] Converting data frame to symmetric matrix

2009-01-08 Thread poastpd
Thank you. It worked! Quoting Henrique Dallazuanna : Try this: reshape(d, timevar = "x", idvar = "y", direction = "wide") On Tue, Jan 6, 2009 at 6:29 AM, wrote: Dear Sir or Madam, I have the following data frame (which is just a toy example of my larger dataset) L3 <- LETTERS[1:3] x=c(1

[R] Converting data frame to symmetric matrix

2009-01-06 Thread poastpd
Dear Sir or Madam, I have the following data frame (which is just a toy example of my larger dataset) L3 <- LETTERS[1:3] x=c(1,1,2,2,3,3,4,4,5,5) y=1:10 d <- data.frame(cbind(x,y), fac=sample(L3, 10, replace=TRUE)) This data frame produces the following output x y fac 1 1 1 C 2 1

[R] Loop to fill in array skips over certain columns

2008-09-12 Thread poastpd
Hello, Below is a simple loop that should place a 3 in the first row of each column in the array "List". iterations<-3 tweaksize<-0.00 ii <-1 List=array(-1000, dim=c(iterations,11)) colnames(List) <- c("orig", "0.05", "0.10", "0.15","0.20","0.25","0.30","0.35","0.40","0.45","0.50") Entry=3