Sorry, I pasted the wrong file in earlier... this is the correct one: pValCalculator(b, n=20, m=20) { ind <- 1:min(c(n,m)) prob <- (1-pnorm(b,sd=std*sqrt(ind))) prob1 <- sum((n-ind+1)*(m-ind+1)*prob) prob1 } inputData <- scan("/users/lvssso/projects/LAMA/output/pValLamaScore.tmp", list(block1 = "",block2 = "",width1 = 0,width2 = 0,alignment = 0,score = 0)); pVal <- vector(mode = "numeric", length(inputData$score)); for(i in 1:length(inputData$score)) pVal[i] <- pValCalculator(inputData$score, inputData$width1, inputData$width2); inputData$pValue <- list(pVal); write.table(inputData, file = "pValLamaScore.out", row.names = FALSE, col.names = FALSE, sep = "\t"); The error seems to be in, in its inability to recognize my self-made function (pValCalculator). Shai -- Shai Shen-Orr Crown Human Genome Center and Bioinformatics Unit, Weizmann Institute of Science Home page and more contact info: http://bioinfo.weizmann.ac.il/~lvssso -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 5 Apr 2000, Shai Shen-Orr wrote:>Sorry, I pasted the wrong file in earlier... this is the correct one: >pValCalculator(b, n=20, m=20) > >The error seems to be in, in its inability to recognize my self-made >function (pValCalculator).Yep, the syntax is pValCalculator <- function(b, n=20, m=20) Best, Kjetil -- Kjetil Kjernsmo Graduate astronomy-student Problems worthy of attack University of Oslo, Norway Prove their worth by hitting back E-mail: kjetikj at astro.uio.no - Piet Hein Homepage <URL:http://www.astro.uio.no/~kjetikj/> Webmaster at skepsis.no -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
try pValCalculator <- function(b,n=20,m=20) { etc... On Wed, 5 Apr 2000, Shai Shen-Orr wrote:> Sorry, I pasted the wrong file in earlier... this is the correct one: > pValCalculator(b, n=20, m=20) > { > ind <- 1:min(c(n,m)) > prob <- (1-pnorm(b,sd=std*sqrt(ind))) > prob1 <- sum((n-ind+1)*(m-ind+1)*prob) > prob1 > } > > inputData <- > scan("/users/lvssso/projects/LAMA/output/pValLamaScore.tmp", list(block1 > = "",block2 = "",width1 = 0,width2 = 0,alignment = 0,score = 0)); > > > pVal <- vector(mode = "numeric", length(inputData$score)); > > for(i in 1:length(inputData$score)) > pVal[i] <- pValCalculator(inputData$score, inputData$width1, > inputData$width2); > > inputData$pValue <- list(pVal); > > write.table(inputData, file = "pValLamaScore.out", row.names = FALSE, > col.names = FALSE, sep = "\t"); > > > The error seems to be in, in its inability to recognize my self-made > function (pValCalculator). > > > Shai > >-- Ben Bolker bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker 318 Carr Hall/Box 118525 tel: (352) 392-5697 Gainesville, FL 32611-8525 fax: (352) 392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._