Re: [R] Saving misclassified records into dataframe within a loop

2011-05-13 Thread John Dennison
ument, x, and didn't > use the argument. Functions don't need arguments, > f <- function() { > > } > would do just as well. > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > -Original Message- > > Fr

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread David Winsemius
On May 12, 2011, at 6:49 PM, John Dennison wrote: It is little ugly i agree but it is acting as it should. I am trying to capture the cases where the model produced a false positive but only for one of the variables. ie where the model predicts "present" but the case is "absent". I know th

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread William Dunlap
r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of John Dennison > Sent: Thursday, May 12, 2011 2:41 PM > To: r-help@r-project.org > Subject: Re: [R] Saving misclassified records into dataframe > within a loop > > Having poked the problem a couple mor

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread John Dennison
It is little ugly i agree but it is acting as it should. I am trying to capture the cases where the model produced a false positive but only for one of the variables. ie where the model predicts "present" but the case is "absent". I know this is only half of the misclassifications, but the inverse

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread David Winsemius
On May 12, 2011, at 6:26 PM, John Dennison wrote: My apologies. I have transgressed the first law of posting, test your code. here is an updated set this should run: library(rpart) # grow tree fit <- rpart(Kyphosis ~ Age + Number + Start, method="class", data=kyphosis) #predict prediction<

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread John Dennison
My apologies. I have transgressed the first law of posting, test your code. here is an updated set this should run: library(rpart) # grow tree fit <- rpart(Kyphosis ~ Age + Number + Start, method="class", data=kyphosis) #predict prediction<-predict(fit, kyphosis) #create output data.frame resul

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread David Winsemius
On May 12, 2011, at 5:41 PM, John Dennison wrote: Having poked the problem a couple more times it appears my issue is that the object i save within the loop is not available after the function ends. I have no idea why it is acting in this manner. library(rpart) # grow tree fit <- rpart(K

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread John Dennison
Having poked the problem a couple more times it appears my issue is that the object i save within the loop is not available after the function ends. I have no idea why it is acting in this manner. library(rpart) # grow tree fit <- rpart(Kyphosis ~ Age + Number + Start, method="class", data=kyph

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread Phil Spector
John - In your example, the misclassified observations (as defined by your predict.function) will be kyphosis[kyphosis$Kyphosis == 'absent' & prediction[,1] != 1,] so you could start from there. - Phil Spector

[R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread John Dennison
Greetings R world, I know some version of the this question has been asked before, but i need to save the output of a loop into a data frame to eventually be written to a postgres data base with dbWriteTable. Some background. I have developed classifications models to help identify problem account