Christian Schulz wrote:
X <- numeric(length(data.frame))
before the loop maybe work, because
my computer works and works !?


christian


---------- Weitergeleitete Nachricht ----------

Subject: filter out many data.frames
Date: Sonntag, 16. Mai 2004 00:02
From: Christian Schulz <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

Hi ,

i would like  filter out all combinations of a  data-mining result?
How i have to declare X because in every loop step it have another lengths ?

  X <- numeric(length(i1,...,i64))  ?

Many thanks
Christian


tres <- function(data.frame) { + data <- expand.grid(class02 = c("A","B","C","D"), class04 = c("A","B","C","D"),PREDICT = c("A","B","C","D")) + for (i in 1:nrow(data)){ + X[i]<- dtree[dtree$class02 == paste(data$class02[i]) & dtree$class04 == paste(data$class04[i]) & dtree$PREDICT==paste(data$PREDICT[i]),] + } + return(X[i]) + }


Eh. You really want to rewrite that code. It depends on objects available in its parent (or grand-parent) envrionment.
I don't see why you need all those calls to paste().
You do *not* want to call an argument data.frame nor any other object data, but you *do* want to use the arguments specified.


Now, if X is initialized with numeric(), X is a numeric (n x 1) vector. I think you need at least a matrix or better a list, if the subsetting stuff returns more or even less than one row.

For a list X use, e.g.,
 X <- vector(nrow(data), mode = "list")
just before the for loop.

Uwe Ligges



tres(dtree)


Error: Object "X" not found

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to