Re: [R] Converting 3 columns of a data frame into a matrix

2010-06-22 Thread David Winsemius
On Jun 22, 2010, at 4:57 AM, Jeff08 wrote: Okay, it crosstab seems to work when I clear out a bunch of my variables, went from 800 mb Vcol to 100 mb Can anyone explain how memory works in R, because my lack of understanding with memory was clearly the problem. Making the assumption th

Re: [R] Converting 3 columns of a data frame into a matrix

2010-06-22 Thread Jeff08
Okay, it crosstab seems to work when I clear out a bunch of my variables, went from 800 mb Vcol to 100 mb Can anyone explain how memory works in R, because my lack of understanding with memory was clearly the problem. Jeff08 wrote: > > ##I have also tried the reshape package > library(reshape)

Re: [R] Converting 3 columns of a data frame into a matrix

2010-06-22 Thread Jeff08
##I have also tried the reshape package library(reshape) mm <- melt(df, id=c("date_", "id")) mm1 <- cast(mm, date_~id) aba <- mm1[,-1] final <- as.matrix(aba) colnames(final) <- df$id rownames(final) <- mm1$date_ final ##Again it works perfectly here, but when I get to my real dataset, I ge

[R] Converting 3 columns of a data frame into a matrix

2010-06-22 Thread Jeff08
df<-data.frame() df[1:8,1]<-c("1","2","5","3","1","4","3","5") ##identifier 1 df[1:8,2]<-c("c","a","b","c","a","b","b","a") ##identifier 2 df[1:8,3]<-c(1,2,3,4,5,6,7,8) ##value ##Each unique combination of identifiers identifies a datapoint ##What I am trying to do is create a matrix with value