Re: [R] Performance problems to fill up a dataframe

2007-09-24 Thread Wayne.W.Jones
Of Florian Jansen Sent: 24 September 2007 10:37 To: r-help@r-project.org Subject: [R] Performance problems to fill up a dataframe Dear Listmembers, I'm trying to fill up a dataframe depending on an arbitrary list of references: Here is my code, which works: dat <- d

Re: [R] Performance problems to fill up a dataframe

2007-09-24 Thread Adrian Dusa
Try to assign some names to your initial variables: dat <- data.frame(A=c(60001,60001,60050,60050,60050), B=c(27,129,618,27,1579)) And what you want is simply: > table(dat) B A 27 129 618 1579 60001 1 1 00 60050 1 0 11 Why do you need it as a dataframe anyway?

[R] Performance problems to fill up a dataframe

2007-09-24 Thread Florian Jansen
Dear Listmembers, I'm trying to fill up a dataframe depending on an arbitrary list of references: Here is my code, which works: dat <- data.frame(c(60001,60001,60050,60050,60050),c(27,129,618,27,1579)) LR <- sort(unique(dat[,1])) LC <- sort(unique(dat[,2])) m <- as.data.frame(matrix(data=NA, nr