[R] script works in Rgui, but failes in Rscript (coords, package 'pROC')

christoph_s cstingl.info06 at aon.at
Sun Apr 14 11:37:08 CEST 2013


Dearh all,
I have following question: a script (using pROC functions) that works when
run in Rgui, failes when run through rscript.

This is the script:

library(pROC)

hits <- c("T", "D", "T", "D", "T", "D", "T", "D", "T", "D", "T", "D", "T",
"D", "T", "D", "T", "D")
score <- c(1.804984e-05, 1.908517e-02, 2.934481e-02, 8.188098e-02,
1.528048e-03, 4.617807e-01, 1.420925e-03, 2.360183e-01, 1.874567e-02,
5.127498e-01, 9.438651e-03, 2.162788e-01, 9.142649e-04, 1.173577e-01,
7.270350e-03, 4.699286e-01, 4.553215e-03, 3.942892e-01)

roc_test <- data.frame (hits, score)

roc1 <- roc(roc_test$hit, roc_test$score, plot = FALSE, smooth = FALSE,
sensitivities = TRUE )
roc.result <- coords(roc1, "best", ret=c("t", "se", "sp"), as.list = TRUE,
best.method=c("closest.topleft"))
print(roc.result$best$threshold)

# script ends here.

However, executing in the command line
(C:\Progra~1\R\R-2.15.3\bin\Rscript.exe ROC_test.R) gives following errors:
Error in ifelse(is(roc, "smooth.roc"), length(attr(roc, "roc")$cases),  :
  could not find function "is"
Calls: coords ... coords.roc -> lapply -> FUN -> coords.roc -> ifelse
Execution halted

Any ideas? Thanks in advance,
Christoph




--
View this message in context: http://r.789695.n4.nabble.com/script-works-in-Rgui-but-failes-in-Rscript-coords-package-pROC-tp4664173.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list